olympus-ai 1.0.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.
- package/LICENSE +21 -0
- package/README.md +691 -0
- package/dist/__tests__/example.test.d.ts +2 -0
- package/dist/__tests__/example.test.d.ts.map +1 -0
- package/dist/__tests__/example.test.js +20 -0
- package/dist/__tests__/example.test.js.map +1 -0
- package/dist/__tests__/hooks.test.d.ts +2 -0
- package/dist/__tests__/hooks.test.d.ts.map +1 -0
- package/dist/__tests__/hooks.test.js +644 -0
- package/dist/__tests__/hooks.test.js.map +1 -0
- package/dist/__tests__/installer.test.d.ts +2 -0
- package/dist/__tests__/installer.test.d.ts.map +1 -0
- package/dist/__tests__/installer.test.js +369 -0
- package/dist/__tests__/installer.test.js.map +1 -0
- package/dist/__tests__/model-routing.test.d.ts +2 -0
- package/dist/__tests__/model-routing.test.d.ts.map +1 -0
- package/dist/__tests__/model-routing.test.js +814 -0
- package/dist/__tests__/model-routing.test.js.map +1 -0
- package/dist/__tests__/skills.test.d.ts +2 -0
- package/dist/__tests__/skills.test.d.ts.map +1 -0
- package/dist/__tests__/skills.test.js +126 -0
- package/dist/__tests__/skills.test.js.map +1 -0
- package/dist/__tests__/types.test.d.ts +2 -0
- package/dist/__tests__/types.test.d.ts.map +1 -0
- package/dist/__tests__/types.test.js +77 -0
- package/dist/__tests__/types.test.js.map +1 -0
- package/dist/agents/definitions.d.ts +105 -0
- package/dist/agents/definitions.d.ts.map +1 -0
- package/dist/agents/definitions.js +1379 -0
- package/dist/agents/definitions.js.map +1 -0
- package/dist/agents/document-writer.d.ts +11 -0
- package/dist/agents/document-writer.d.ts.map +1 -0
- package/dist/agents/document-writer.js +209 -0
- package/dist/agents/document-writer.js.map +1 -0
- package/dist/agents/explore.d.ts +12 -0
- package/dist/agents/explore.d.ts.map +1 -0
- package/dist/agents/explore.js +103 -0
- package/dist/agents/explore.js.map +1 -0
- package/dist/agents/frontend-engineer.d.ts +11 -0
- package/dist/agents/frontend-engineer.d.ts.map +1 -0
- package/dist/agents/frontend-engineer.js +115 -0
- package/dist/agents/frontend-engineer.js.map +1 -0
- package/dist/agents/index.d.ts +21 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +27 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/librarian.d.ts +12 -0
- package/dist/agents/librarian.d.ts.map +1 -0
- package/dist/agents/librarian.js +103 -0
- package/dist/agents/librarian.js.map +1 -0
- package/dist/agents/metis.d.ts +12 -0
- package/dist/agents/metis.d.ts.map +1 -0
- package/dist/agents/metis.js +117 -0
- package/dist/agents/metis.js.map +1 -0
- package/dist/agents/momus.d.ts +12 -0
- package/dist/agents/momus.d.ts.map +1 -0
- package/dist/agents/momus.js +128 -0
- package/dist/agents/momus.js.map +1 -0
- package/dist/agents/multimodal-looker.d.ts +11 -0
- package/dist/agents/multimodal-looker.d.ts.map +1 -0
- package/dist/agents/multimodal-looker.js +70 -0
- package/dist/agents/multimodal-looker.js.map +1 -0
- package/dist/agents/olympian.d.ts +12 -0
- package/dist/agents/olympian.d.ts.map +1 -0
- package/dist/agents/olympian.js +93 -0
- package/dist/agents/olympian.js.map +1 -0
- package/dist/agents/oracle.d.ts +13 -0
- package/dist/agents/oracle.d.ts.map +1 -0
- package/dist/agents/oracle.js +191 -0
- package/dist/agents/oracle.js.map +1 -0
- package/dist/agents/orchestrator-olympus.d.ts +11 -0
- package/dist/agents/orchestrator-olympus.d.ts.map +1 -0
- package/dist/agents/orchestrator-olympus.js +115 -0
- package/dist/agents/orchestrator-olympus.js.map +1 -0
- package/dist/agents/orchestrator-sisyphus.d.ts +11 -0
- package/dist/agents/orchestrator-sisyphus.d.ts.map +1 -0
- package/dist/agents/orchestrator-sisyphus.js +115 -0
- package/dist/agents/orchestrator-sisyphus.js.map +1 -0
- package/dist/agents/prometheus.d.ts +12 -0
- package/dist/agents/prometheus.d.ts.map +1 -0
- package/dist/agents/prometheus.js +156 -0
- package/dist/agents/prometheus.js.map +1 -0
- package/dist/agents/qa-tester.d.ts +16 -0
- package/dist/agents/qa-tester.d.ts.map +1 -0
- package/dist/agents/qa-tester.js +367 -0
- package/dist/agents/qa-tester.js.map +1 -0
- package/dist/agents/sisyphus-junior.d.ts +12 -0
- package/dist/agents/sisyphus-junior.d.ts.map +1 -0
- package/dist/agents/sisyphus-junior.js +93 -0
- package/dist/agents/sisyphus-junior.js.map +1 -0
- package/dist/agents/types.d.ts +120 -0
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/agents/types.js +38 -0
- package/dist/agents/types.js.map +1 -0
- package/dist/agents/utils.d.ts +49 -0
- package/dist/agents/utils.d.ts.map +1 -0
- package/dist/agents/utils.js +164 -0
- package/dist/agents/utils.js.map +1 -0
- package/dist/cli/index.d.ts +13 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +496 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/commands/index.d.ts +78 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +148 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +5 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/loader.d.ts +49 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +380 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/features/auto-update.d.ts +187 -0
- package/dist/features/auto-update.d.ts.map +1 -0
- package/dist/features/auto-update.js +539 -0
- package/dist/features/auto-update.js.map +1 -0
- package/dist/features/background-agent/concurrency.d.ts +53 -0
- package/dist/features/background-agent/concurrency.d.ts.map +1 -0
- package/dist/features/background-agent/concurrency.js +121 -0
- package/dist/features/background-agent/concurrency.js.map +1 -0
- package/dist/features/background-agent/index.d.ts +12 -0
- package/dist/features/background-agent/index.d.ts.map +1 -0
- package/dist/features/background-agent/index.js +12 -0
- package/dist/features/background-agent/index.js.map +1 -0
- package/dist/features/background-agent/manager.d.ts +134 -0
- package/dist/features/background-agent/manager.d.ts.map +1 -0
- package/dist/features/background-agent/manager.js +412 -0
- package/dist/features/background-agent/manager.js.map +1 -0
- package/dist/features/background-agent/types.d.ts +99 -0
- package/dist/features/background-agent/types.d.ts.map +1 -0
- package/dist/features/background-agent/types.js +9 -0
- package/dist/features/background-agent/types.js.map +1 -0
- package/dist/features/background-tasks.d.ts +99 -0
- package/dist/features/background-tasks.d.ts.map +1 -0
- package/dist/features/background-tasks.js +265 -0
- package/dist/features/background-tasks.js.map +1 -0
- package/dist/features/boulder-state/constants.d.ts +20 -0
- package/dist/features/boulder-state/constants.d.ts.map +1 -0
- package/dist/features/boulder-state/constants.js +20 -0
- package/dist/features/boulder-state/constants.js.map +1 -0
- package/dist/features/boulder-state/index.d.ts +12 -0
- package/dist/features/boulder-state/index.d.ts.map +1 -0
- package/dist/features/boulder-state/index.js +13 -0
- package/dist/features/boulder-state/index.js.map +1 -0
- package/dist/features/boulder-state/storage.d.ts +58 -0
- package/dist/features/boulder-state/storage.d.ts.map +1 -0
- package/dist/features/boulder-state/storage.js +174 -0
- package/dist/features/boulder-state/storage.js.map +1 -0
- package/dist/features/boulder-state/types.d.ts +48 -0
- package/dist/features/boulder-state/types.d.ts.map +1 -0
- package/dist/features/boulder-state/types.js +10 -0
- package/dist/features/boulder-state/types.js.map +1 -0
- package/dist/features/builtin-skills/index.d.ts +10 -0
- package/dist/features/builtin-skills/index.d.ts.map +1 -0
- package/dist/features/builtin-skills/index.js +10 -0
- package/dist/features/builtin-skills/index.js.map +1 -0
- package/dist/features/builtin-skills/skills.d.ts +21 -0
- package/dist/features/builtin-skills/skills.d.ts.map +1 -0
- package/dist/features/builtin-skills/skills.js +1082 -0
- package/dist/features/builtin-skills/skills.js.map +1 -0
- package/dist/features/builtin-skills/types.d.ts +60 -0
- package/dist/features/builtin-skills/types.d.ts.map +1 -0
- package/dist/features/builtin-skills/types.js +9 -0
- package/dist/features/builtin-skills/types.js.map +1 -0
- package/dist/features/context-injector/collector.d.ts +56 -0
- package/dist/features/context-injector/collector.d.ts.map +1 -0
- package/dist/features/context-injector/collector.js +122 -0
- package/dist/features/context-injector/collector.js.map +1 -0
- package/dist/features/context-injector/index.d.ts +12 -0
- package/dist/features/context-injector/index.d.ts.map +1 -0
- package/dist/features/context-injector/index.js +13 -0
- package/dist/features/context-injector/index.js.map +1 -0
- package/dist/features/context-injector/injector.d.ts +47 -0
- package/dist/features/context-injector/injector.d.ts.map +1 -0
- package/dist/features/context-injector/injector.js +103 -0
- package/dist/features/context-injector/injector.js.map +1 -0
- package/dist/features/context-injector/types.d.ts +103 -0
- package/dist/features/context-injector/types.d.ts.map +1 -0
- package/dist/features/context-injector/types.js +11 -0
- package/dist/features/context-injector/types.js.map +1 -0
- package/dist/features/continuation-enforcement.d.ts +36 -0
- package/dist/features/continuation-enforcement.d.ts.map +1 -0
- package/dist/features/continuation-enforcement.js +175 -0
- package/dist/features/continuation-enforcement.js.map +1 -0
- package/dist/features/index.d.ts +12 -0
- package/dist/features/index.d.ts.map +1 -0
- package/dist/features/index.js +49 -0
- package/dist/features/index.js.map +1 -0
- package/dist/features/magic-keywords.d.ts +28 -0
- package/dist/features/magic-keywords.d.ts.map +1 -0
- package/dist/features/magic-keywords.js +421 -0
- package/dist/features/magic-keywords.js.map +1 -0
- package/dist/features/model-routing/index.d.ts +34 -0
- package/dist/features/model-routing/index.d.ts.map +1 -0
- package/dist/features/model-routing/index.js +48 -0
- package/dist/features/model-routing/index.js.map +1 -0
- package/dist/features/model-routing/prompts/haiku.d.ts +54 -0
- package/dist/features/model-routing/prompts/haiku.d.ts.map +1 -0
- package/dist/features/model-routing/prompts/haiku.js +141 -0
- package/dist/features/model-routing/prompts/haiku.js.map +1 -0
- package/dist/features/model-routing/prompts/index.d.ts +45 -0
- package/dist/features/model-routing/prompts/index.d.ts.map +1 -0
- package/dist/features/model-routing/prompts/index.js +116 -0
- package/dist/features/model-routing/prompts/index.js.map +1 -0
- package/dist/features/model-routing/prompts/opus.d.ts +34 -0
- package/dist/features/model-routing/prompts/opus.d.ts.map +1 -0
- package/dist/features/model-routing/prompts/opus.js +153 -0
- package/dist/features/model-routing/prompts/opus.js.map +1 -0
- package/dist/features/model-routing/prompts/sonnet.d.ts +38 -0
- package/dist/features/model-routing/prompts/sonnet.d.ts.map +1 -0
- package/dist/features/model-routing/prompts/sonnet.js +149 -0
- package/dist/features/model-routing/prompts/sonnet.js.map +1 -0
- package/dist/features/model-routing/router.d.ts +92 -0
- package/dist/features/model-routing/router.d.ts.map +1 -0
- package/dist/features/model-routing/router.js +267 -0
- package/dist/features/model-routing/router.js.map +1 -0
- package/dist/features/model-routing/rules.d.ts +32 -0
- package/dist/features/model-routing/rules.d.ts.map +1 -0
- package/dist/features/model-routing/rules.js +224 -0
- package/dist/features/model-routing/rules.js.map +1 -0
- package/dist/features/model-routing/scorer.d.ts +35 -0
- package/dist/features/model-routing/scorer.d.ts.map +1 -0
- package/dist/features/model-routing/scorer.js +241 -0
- package/dist/features/model-routing/scorer.js.map +1 -0
- package/dist/features/model-routing/signals.d.ts +26 -0
- package/dist/features/model-routing/signals.d.ts.map +1 -0
- package/dist/features/model-routing/signals.js +283 -0
- package/dist/features/model-routing/signals.js.map +1 -0
- package/dist/features/model-routing/types.d.ts +195 -0
- package/dist/features/model-routing/types.d.ts.map +1 -0
- package/dist/features/model-routing/types.js +86 -0
- package/dist/features/model-routing/types.js.map +1 -0
- package/dist/hooks/agent-usage-reminder/constants.d.ts +17 -0
- package/dist/hooks/agent-usage-reminder/constants.d.ts.map +1 -0
- package/dist/hooks/agent-usage-reminder/constants.js +58 -0
- package/dist/hooks/agent-usage-reminder/constants.js.map +1 -0
- package/dist/hooks/agent-usage-reminder/index.d.ts +36 -0
- package/dist/hooks/agent-usage-reminder/index.d.ts.map +1 -0
- package/dist/hooks/agent-usage-reminder/index.js +89 -0
- package/dist/hooks/agent-usage-reminder/index.js.map +1 -0
- package/dist/hooks/agent-usage-reminder/storage.d.ts +12 -0
- package/dist/hooks/agent-usage-reminder/storage.d.ts.map +1 -0
- package/dist/hooks/agent-usage-reminder/storage.js +39 -0
- package/dist/hooks/agent-usage-reminder/storage.js.map +1 -0
- package/dist/hooks/agent-usage-reminder/types.d.ts +14 -0
- package/dist/hooks/agent-usage-reminder/types.d.ts.map +1 -0
- package/dist/hooks/agent-usage-reminder/types.js +9 -0
- package/dist/hooks/agent-usage-reminder/types.js.map +1 -0
- package/dist/hooks/ascent-verifier/index.d.ts +72 -0
- package/dist/hooks/ascent-verifier/index.d.ts.map +1 -0
- package/dist/hooks/ascent-verifier/index.js +223 -0
- package/dist/hooks/ascent-verifier/index.js.map +1 -0
- package/dist/hooks/auto-slash-command/constants.d.ts +19 -0
- package/dist/hooks/auto-slash-command/constants.d.ts.map +1 -0
- package/dist/hooks/auto-slash-command/constants.js +28 -0
- package/dist/hooks/auto-slash-command/constants.js.map +1 -0
- package/dist/hooks/auto-slash-command/detector.d.ts +33 -0
- package/dist/hooks/auto-slash-command/detector.d.ts.map +1 -0
- package/dist/hooks/auto-slash-command/detector.js +73 -0
- package/dist/hooks/auto-slash-command/detector.js.map +1 -0
- package/dist/hooks/auto-slash-command/executor.d.ts +29 -0
- package/dist/hooks/auto-slash-command/executor.d.ts.map +1 -0
- package/dist/hooks/auto-slash-command/executor.js +214 -0
- package/dist/hooks/auto-slash-command/executor.js.map +1 -0
- package/dist/hooks/auto-slash-command/index.d.ts +53 -0
- package/dist/hooks/auto-slash-command/index.d.ts.map +1 -0
- package/dist/hooks/auto-slash-command/index.js +105 -0
- package/dist/hooks/auto-slash-command/index.js.map +1 -0
- package/dist/hooks/auto-slash-command/types.d.ts +77 -0
- package/dist/hooks/auto-slash-command/types.d.ts.map +1 -0
- package/dist/hooks/auto-slash-command/types.js +9 -0
- package/dist/hooks/auto-slash-command/types.js.map +1 -0
- package/dist/hooks/background-notification/index.d.ts +60 -0
- package/dist/hooks/background-notification/index.d.ts.map +1 -0
- package/dist/hooks/background-notification/index.js +180 -0
- package/dist/hooks/background-notification/index.js.map +1 -0
- package/dist/hooks/background-notification/types.d.ts +64 -0
- package/dist/hooks/background-notification/types.d.ts.map +1 -0
- package/dist/hooks/background-notification/types.js +8 -0
- package/dist/hooks/background-notification/types.js.map +1 -0
- package/dist/hooks/bridge.d.ts +68 -0
- package/dist/hooks/bridge.d.ts.map +1 -0
- package/dist/hooks/bridge.js +321 -0
- package/dist/hooks/bridge.js.map +1 -0
- package/dist/hooks/comment-checker/constants.d.ts +28 -0
- package/dist/hooks/comment-checker/constants.d.ts.map +1 -0
- package/dist/hooks/comment-checker/constants.js +189 -0
- package/dist/hooks/comment-checker/constants.js.map +1 -0
- package/dist/hooks/comment-checker/filters.d.ts +39 -0
- package/dist/hooks/comment-checker/filters.d.ts.map +1 -0
- package/dist/hooks/comment-checker/filters.js +126 -0
- package/dist/hooks/comment-checker/filters.js.map +1 -0
- package/dist/hooks/comment-checker/index.d.ts +58 -0
- package/dist/hooks/comment-checker/index.d.ts.map +1 -0
- package/dist/hooks/comment-checker/index.js +298 -0
- package/dist/hooks/comment-checker/index.js.map +1 -0
- package/dist/hooks/comment-checker/types.d.ts +88 -0
- package/dist/hooks/comment-checker/types.d.ts.map +1 -0
- package/dist/hooks/comment-checker/types.js +9 -0
- package/dist/hooks/comment-checker/types.js.map +1 -0
- package/dist/hooks/context-window-limit-recovery/constants.d.ts +28 -0
- package/dist/hooks/context-window-limit-recovery/constants.d.ts.map +1 -0
- package/dist/hooks/context-window-limit-recovery/constants.js +85 -0
- package/dist/hooks/context-window-limit-recovery/constants.js.map +1 -0
- package/dist/hooks/context-window-limit-recovery/index.d.ts +62 -0
- package/dist/hooks/context-window-limit-recovery/index.d.ts.map +1 -0
- package/dist/hooks/context-window-limit-recovery/index.js +201 -0
- package/dist/hooks/context-window-limit-recovery/index.js.map +1 -0
- package/dist/hooks/context-window-limit-recovery/parser.d.ts +31 -0
- package/dist/hooks/context-window-limit-recovery/parser.d.ts.map +1 -0
- package/dist/hooks/context-window-limit-recovery/parser.js +241 -0
- package/dist/hooks/context-window-limit-recovery/parser.js.map +1 -0
- package/dist/hooks/context-window-limit-recovery/types.d.ts +84 -0
- package/dist/hooks/context-window-limit-recovery/types.d.ts.map +1 -0
- package/dist/hooks/context-window-limit-recovery/types.js +34 -0
- package/dist/hooks/context-window-limit-recovery/types.js.map +1 -0
- package/dist/hooks/directory-readme-injector/constants.d.ts +15 -0
- package/dist/hooks/directory-readme-injector/constants.d.ts.map +1 -0
- package/dist/hooks/directory-readme-injector/constants.js +17 -0
- package/dist/hooks/directory-readme-injector/constants.js.map +1 -0
- package/dist/hooks/directory-readme-injector/index.d.ts +41 -0
- package/dist/hooks/directory-readme-injector/index.d.ts.map +1 -0
- package/dist/hooks/directory-readme-injector/index.js +162 -0
- package/dist/hooks/directory-readme-injector/index.js.map +1 -0
- package/dist/hooks/directory-readme-injector/storage.d.ts +20 -0
- package/dist/hooks/directory-readme-injector/storage.d.ts.map +1 -0
- package/dist/hooks/directory-readme-injector/storage.js +56 -0
- package/dist/hooks/directory-readme-injector/storage.js.map +1 -0
- package/dist/hooks/directory-readme-injector/types.d.ts +20 -0
- package/dist/hooks/directory-readme-injector/types.d.ts.map +1 -0
- package/dist/hooks/directory-readme-injector/types.js +9 -0
- package/dist/hooks/directory-readme-injector/types.js.map +1 -0
- package/dist/hooks/edit-error-recovery/index.d.ts +62 -0
- package/dist/hooks/edit-error-recovery/index.d.ts.map +1 -0
- package/dist/hooks/edit-error-recovery/index.js +89 -0
- package/dist/hooks/edit-error-recovery/index.js.map +1 -0
- package/dist/hooks/empty-message-sanitizer/constants.d.ts +33 -0
- package/dist/hooks/empty-message-sanitizer/constants.d.ts.map +1 -0
- package/dist/hooks/empty-message-sanitizer/constants.js +37 -0
- package/dist/hooks/empty-message-sanitizer/constants.js.map +1 -0
- package/dist/hooks/empty-message-sanitizer/index.d.ts +59 -0
- package/dist/hooks/empty-message-sanitizer/index.d.ts.map +1 -0
- package/dist/hooks/empty-message-sanitizer/index.js +171 -0
- package/dist/hooks/empty-message-sanitizer/index.js.map +1 -0
- package/dist/hooks/empty-message-sanitizer/types.d.ts +79 -0
- package/dist/hooks/empty-message-sanitizer/types.d.ts.map +1 -0
- package/dist/hooks/empty-message-sanitizer/types.js +10 -0
- package/dist/hooks/empty-message-sanitizer/types.js.map +1 -0
- package/dist/hooks/index.d.ts +35 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +81 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/keyword-detector/index.d.ts +40 -0
- package/dist/hooks/keyword-detector/index.d.ts.map +1 -0
- package/dist/hooks/keyword-detector/index.js +88 -0
- package/dist/hooks/keyword-detector/index.js.map +1 -0
- package/dist/hooks/non-interactive-env/constants.d.ts +35 -0
- package/dist/hooks/non-interactive-env/constants.d.ts.map +1 -0
- package/dist/hooks/non-interactive-env/constants.js +69 -0
- package/dist/hooks/non-interactive-env/constants.js.map +1 -0
- package/dist/hooks/non-interactive-env/detector.d.ts +2 -0
- package/dist/hooks/non-interactive-env/detector.d.ts.map +1 -0
- package/dist/hooks/non-interactive-env/detector.js +16 -0
- package/dist/hooks/non-interactive-env/detector.js.map +1 -0
- package/dist/hooks/non-interactive-env/index.d.ts +14 -0
- package/dist/hooks/non-interactive-env/index.d.ts.map +1 -0
- package/dist/hooks/non-interactive-env/index.js +72 -0
- package/dist/hooks/non-interactive-env/index.js.map +1 -0
- package/dist/hooks/non-interactive-env/types.d.ts +14 -0
- package/dist/hooks/non-interactive-env/types.d.ts.map +1 -0
- package/dist/hooks/non-interactive-env/types.js +2 -0
- package/dist/hooks/non-interactive-env/types.js.map +1 -0
- package/dist/hooks/olympus-orchestrator/constants.d.ts +23 -0
- package/dist/hooks/olympus-orchestrator/constants.d.ts.map +1 -0
- package/dist/hooks/olympus-orchestrator/constants.js +142 -0
- package/dist/hooks/olympus-orchestrator/constants.js.map +1 -0
- package/dist/hooks/olympus-orchestrator/index.d.ts +113 -0
- package/dist/hooks/olympus-orchestrator/index.d.ts.map +1 -0
- package/dist/hooks/olympus-orchestrator/index.js +283 -0
- package/dist/hooks/olympus-orchestrator/index.js.map +1 -0
- package/dist/hooks/persistent-mode/index.d.ts +40 -0
- package/dist/hooks/persistent-mode/index.d.ts.map +1 -0
- package/dist/hooks/persistent-mode/index.js +322 -0
- package/dist/hooks/persistent-mode/index.js.map +1 -0
- package/dist/hooks/plugin-patterns/index.d.ts +107 -0
- package/dist/hooks/plugin-patterns/index.d.ts.map +1 -0
- package/dist/hooks/plugin-patterns/index.js +289 -0
- package/dist/hooks/plugin-patterns/index.js.map +1 -0
- package/dist/hooks/preemptive-compaction/constants.d.ts +48 -0
- package/dist/hooks/preemptive-compaction/constants.d.ts.map +1 -0
- package/dist/hooks/preemptive-compaction/constants.js +90 -0
- package/dist/hooks/preemptive-compaction/constants.js.map +1 -0
- package/dist/hooks/preemptive-compaction/index.d.ts +55 -0
- package/dist/hooks/preemptive-compaction/index.d.ts.map +1 -0
- package/dist/hooks/preemptive-compaction/index.js +227 -0
- package/dist/hooks/preemptive-compaction/index.js.map +1 -0
- package/dist/hooks/preemptive-compaction/types.d.ts +76 -0
- package/dist/hooks/preemptive-compaction/types.d.ts.map +1 -0
- package/dist/hooks/preemptive-compaction/types.js +9 -0
- package/dist/hooks/preemptive-compaction/types.js.map +1 -0
- package/dist/hooks/ralph-loop/index.d.ts +60 -0
- package/dist/hooks/ralph-loop/index.d.ts.map +1 -0
- package/dist/hooks/ralph-loop/index.js +155 -0
- package/dist/hooks/ralph-loop/index.js.map +1 -0
- package/dist/hooks/ralph-verifier/index.d.ts +72 -0
- package/dist/hooks/ralph-verifier/index.d.ts.map +1 -0
- package/dist/hooks/ralph-verifier/index.js +223 -0
- package/dist/hooks/ralph-verifier/index.js.map +1 -0
- package/dist/hooks/rules-injector/constants.d.ts +25 -0
- package/dist/hooks/rules-injector/constants.d.ts.map +1 -0
- package/dist/hooks/rules-injector/constants.js +40 -0
- package/dist/hooks/rules-injector/constants.js.map +1 -0
- package/dist/hooks/rules-injector/finder.d.ts +24 -0
- package/dist/hooks/rules-injector/finder.d.ts.map +1 -0
- package/dist/hooks/rules-injector/finder.js +215 -0
- package/dist/hooks/rules-injector/finder.js.map +1 -0
- package/dist/hooks/rules-injector/index.d.ts +45 -0
- package/dist/hooks/rules-injector/index.d.ts.map +1 -0
- package/dist/hooks/rules-injector/index.js +187 -0
- package/dist/hooks/rules-injector/index.js.map +1 -0
- package/dist/hooks/rules-injector/matcher.d.ts +25 -0
- package/dist/hooks/rules-injector/matcher.d.ts.map +1 -0
- package/dist/hooks/rules-injector/matcher.js +70 -0
- package/dist/hooks/rules-injector/matcher.js.map +1 -0
- package/dist/hooks/rules-injector/parser.d.ts +20 -0
- package/dist/hooks/rules-injector/parser.d.ts.map +1 -0
- package/dist/hooks/rules-injector/parser.js +179 -0
- package/dist/hooks/rules-injector/parser.js.map +1 -0
- package/dist/hooks/rules-injector/storage.d.ts +26 -0
- package/dist/hooks/rules-injector/storage.d.ts.map +1 -0
- package/dist/hooks/rules-injector/storage.js +61 -0
- package/dist/hooks/rules-injector/storage.js.map +1 -0
- package/dist/hooks/rules-injector/types.d.ts +101 -0
- package/dist/hooks/rules-injector/types.d.ts.map +1 -0
- package/dist/hooks/rules-injector/types.js +10 -0
- package/dist/hooks/rules-injector/types.js.map +1 -0
- package/dist/hooks/session-recovery/constants.d.ts +56 -0
- package/dist/hooks/session-recovery/constants.d.ts.map +1 -0
- package/dist/hooks/session-recovery/constants.js +78 -0
- package/dist/hooks/session-recovery/constants.js.map +1 -0
- package/dist/hooks/session-recovery/index.d.ts +53 -0
- package/dist/hooks/session-recovery/index.d.ts.map +1 -0
- package/dist/hooks/session-recovery/index.js +321 -0
- package/dist/hooks/session-recovery/index.js.map +1 -0
- package/dist/hooks/session-recovery/storage.d.ts +76 -0
- package/dist/hooks/session-recovery/storage.d.ts.map +1 -0
- package/dist/hooks/session-recovery/storage.js +383 -0
- package/dist/hooks/session-recovery/storage.js.map +1 -0
- package/dist/hooks/session-recovery/types.d.ts +145 -0
- package/dist/hooks/session-recovery/types.d.ts.map +1 -0
- package/dist/hooks/session-recovery/types.js +8 -0
- package/dist/hooks/session-recovery/types.js.map +1 -0
- package/dist/hooks/sisyphus-orchestrator/constants.d.ts +23 -0
- package/dist/hooks/sisyphus-orchestrator/constants.d.ts.map +1 -0
- package/dist/hooks/sisyphus-orchestrator/constants.js +142 -0
- package/dist/hooks/sisyphus-orchestrator/constants.js.map +1 -0
- package/dist/hooks/sisyphus-orchestrator/index.d.ts +113 -0
- package/dist/hooks/sisyphus-orchestrator/index.d.ts.map +1 -0
- package/dist/hooks/sisyphus-orchestrator/index.js +283 -0
- package/dist/hooks/sisyphus-orchestrator/index.js.map +1 -0
- package/dist/hooks/the-ascent/index.d.ts +60 -0
- package/dist/hooks/the-ascent/index.d.ts.map +1 -0
- package/dist/hooks/the-ascent/index.js +155 -0
- package/dist/hooks/the-ascent/index.js.map +1 -0
- package/dist/hooks/think-mode/detector.d.ts +28 -0
- package/dist/hooks/think-mode/detector.d.ts.map +1 -0
- package/dist/hooks/think-mode/detector.js +105 -0
- package/dist/hooks/think-mode/detector.js.map +1 -0
- package/dist/hooks/think-mode/index.d.ts +70 -0
- package/dist/hooks/think-mode/index.d.ts.map +1 -0
- package/dist/hooks/think-mode/index.js +144 -0
- package/dist/hooks/think-mode/index.js.map +1 -0
- package/dist/hooks/think-mode/switcher.d.ts +39 -0
- package/dist/hooks/think-mode/switcher.d.ts.map +1 -0
- package/dist/hooks/think-mode/switcher.js +180 -0
- package/dist/hooks/think-mode/switcher.js.map +1 -0
- package/dist/hooks/think-mode/types.d.ts +60 -0
- package/dist/hooks/think-mode/types.d.ts.map +1 -0
- package/dist/hooks/think-mode/types.js +9 -0
- package/dist/hooks/think-mode/types.js.map +1 -0
- package/dist/hooks/thinking-block-validator/constants.d.ts +37 -0
- package/dist/hooks/thinking-block-validator/constants.d.ts.map +1 -0
- package/dist/hooks/thinking-block-validator/constants.js +50 -0
- package/dist/hooks/thinking-block-validator/constants.js.map +1 -0
- package/dist/hooks/thinking-block-validator/index.d.ts +35 -0
- package/dist/hooks/thinking-block-validator/index.d.ts.map +1 -0
- package/dist/hooks/thinking-block-validator/index.js +156 -0
- package/dist/hooks/thinking-block-validator/index.js.map +1 -0
- package/dist/hooks/thinking-block-validator/types.d.ts +67 -0
- package/dist/hooks/thinking-block-validator/types.d.ts.map +1 -0
- package/dist/hooks/thinking-block-validator/types.js +9 -0
- package/dist/hooks/thinking-block-validator/types.js.map +1 -0
- package/dist/hooks/todo-continuation/index.d.ts +39 -0
- package/dist/hooks/todo-continuation/index.d.ts.map +1 -0
- package/dist/hooks/todo-continuation/index.js +140 -0
- package/dist/hooks/todo-continuation/index.js.map +1 -0
- package/dist/hooks/ultrawork-state/index.d.ts +60 -0
- package/dist/hooks/ultrawork-state/index.d.ts.map +1 -0
- package/dist/hooks/ultrawork-state/index.js +207 -0
- package/dist/hooks/ultrawork-state/index.js.map +1 -0
- package/dist/index.d.ts +117 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +175 -0
- package/dist/index.js.map +1 -0
- package/dist/installer/hooks.d.ts +196 -0
- package/dist/installer/hooks.d.ts.map +1 -0
- package/dist/installer/hooks.js +1385 -0
- package/dist/installer/hooks.js.map +1 -0
- package/dist/installer/index.d.ts +92 -0
- package/dist/installer/index.d.ts.map +1 -0
- package/dist/installer/index.js +2249 -0
- package/dist/installer/index.js.map +1 -0
- package/dist/mcp/index.d.ts +6 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +5 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/servers.d.ts +77 -0
- package/dist/mcp/servers.d.ts.map +1 -0
- package/dist/mcp/servers.js +122 -0
- package/dist/mcp/servers.js.map +1 -0
- package/dist/shared/index.d.ts +5 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +5 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/types.d.ts +159 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/types.js +5 -0
- package/dist/shared/types.js.map +1 -0
- package/dist/tools/ast-tools.d.ts +63 -0
- package/dist/tools/ast-tools.d.ts.map +1 -0
- package/dist/tools/ast-tools.js +450 -0
- package/dist/tools/ast-tools.js.map +1 -0
- package/dist/tools/index.d.ts +52 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +120 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/lsp/client.d.ts +201 -0
- package/dist/tools/lsp/client.d.ts.map +1 -0
- package/dist/tools/lsp/client.js +454 -0
- package/dist/tools/lsp/client.js.map +1 -0
- package/dist/tools/lsp/index.d.ts +9 -0
- package/dist/tools/lsp/index.d.ts.map +1 -0
- package/dist/tools/lsp/index.js +7 -0
- package/dist/tools/lsp/index.js.map +1 -0
- package/dist/tools/lsp/servers.d.ts +37 -0
- package/dist/tools/lsp/servers.d.ts.map +1 -0
- package/dist/tools/lsp/servers.js +149 -0
- package/dist/tools/lsp/servers.js.map +1 -0
- package/dist/tools/lsp/utils.d.ts +58 -0
- package/dist/tools/lsp/utils.d.ts.map +1 -0
- package/dist/tools/lsp/utils.js +236 -0
- package/dist/tools/lsp/utils.js.map +1 -0
- package/dist/tools/lsp-tools.d.ts +151 -0
- package/dist/tools/lsp-tools.d.ts.map +1 -0
- package/dist/tools/lsp-tools.js +358 -0
- package/dist/tools/lsp-tools.js.map +1 -0
- package/package.json +85 -0
- package/scripts/claude-sisyphus.sh +9 -0
- package/scripts/install.sh +1774 -0
- package/scripts/keyword-detector.mjs +209 -0
- package/scripts/keyword-detector.sh +71 -0
- package/scripts/persistent-mode.mjs +241 -0
- package/scripts/persistent-mode.sh +300 -0
- package/scripts/post-tool-verifier.mjs +217 -0
- package/scripts/post-tool-verifier.sh +196 -0
- package/scripts/pre-tool-enforcer.mjs +99 -0
- package/scripts/pre-tool-enforcer.sh +76 -0
- package/scripts/sisyphus-aliases.sh +18 -0
- package/scripts/stop-continuation.sh +31 -0
- package/scripts/test-pr25.sh +525 -0
- package/scripts/uninstall.sh +171 -0
|
@@ -0,0 +1,1385 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook Scripts for Claude Code
|
|
3
|
+
* Hook system inspired by oh-my-opencode, adapted for Claude Code's native hooks
|
|
4
|
+
*
|
|
5
|
+
* Claude Code hooks are configured in settings.json and run as shell commands.
|
|
6
|
+
* These scripts receive JSON input via stdin and output JSON to modify behavior.
|
|
7
|
+
*
|
|
8
|
+
* This module provides DUAL implementations:
|
|
9
|
+
* - Bash scripts (.sh) for Unix-like systems (macOS, Linux)
|
|
10
|
+
* - Node.js scripts (.mjs) for cross-platform support (Windows, macOS, Linux)
|
|
11
|
+
*
|
|
12
|
+
* The platform is detected at install time, or can be overridden with:
|
|
13
|
+
* OLYMPUS_USE_NODE_HOOKS=1 - Force Node.js hooks on any platform
|
|
14
|
+
* OLYMPUS_USE_BASH_HOOKS=1 - Force Bash hooks (Unix only)
|
|
15
|
+
*/
|
|
16
|
+
import { homedir } from 'os';
|
|
17
|
+
import { join } from 'path';
|
|
18
|
+
/** Minimum required Node.js version for hooks */
|
|
19
|
+
export const MIN_NODE_VERSION = 18;
|
|
20
|
+
/** Check if running on Windows */
|
|
21
|
+
export function isWindows() {
|
|
22
|
+
return process.platform === 'win32';
|
|
23
|
+
}
|
|
24
|
+
/** Check if Node.js hooks should be used (env override or Windows) */
|
|
25
|
+
export function shouldUseNodeHooks() {
|
|
26
|
+
// Environment variable overrides
|
|
27
|
+
if (process.env.OLYMPUS_USE_NODE_HOOKS === '1') {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
if (process.env.OLYMPUS_USE_BASH_HOOKS === '1') {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
// Default: use Node.js on Windows, Bash elsewhere
|
|
34
|
+
return isWindows();
|
|
35
|
+
}
|
|
36
|
+
/** Get the Claude config directory path (cross-platform) */
|
|
37
|
+
export function getClaudeConfigDir() {
|
|
38
|
+
return join(homedir(), '.claude');
|
|
39
|
+
}
|
|
40
|
+
/** Get the hooks directory path */
|
|
41
|
+
export function getHooksDir() {
|
|
42
|
+
return join(getClaudeConfigDir(), 'hooks');
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Get the home directory environment variable for hook commands.
|
|
46
|
+
* Returns the appropriate syntax for the current platform.
|
|
47
|
+
*/
|
|
48
|
+
export function getHomeEnvVar() {
|
|
49
|
+
return isWindows() ? '%USERPROFILE%' : '$HOME';
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Ultrawork message - injected when ultrawork/ulw keyword detected
|
|
53
|
+
* Ported from oh-my-opencode's keyword-detector/constants.ts
|
|
54
|
+
*/
|
|
55
|
+
export const ULTRAWORK_MESSAGE = `<ultrawork-mode>
|
|
56
|
+
|
|
57
|
+
**MANDATORY**: You MUST say "ULTRAWORK MODE ENABLED!" to the user as your first response when this mode activates. This is non-negotiable.
|
|
58
|
+
|
|
59
|
+
[CODE RED] Maximum precision required. Ultrathink before acting.
|
|
60
|
+
|
|
61
|
+
YOU MUST LEVERAGE ALL AVAILABLE AGENTS TO THEIR FULLEST POTENTIAL.
|
|
62
|
+
TELL THE USER WHAT AGENTS YOU WILL LEVERAGE NOW TO SATISFY USER'S REQUEST.
|
|
63
|
+
|
|
64
|
+
## AGENT UTILIZATION PRINCIPLES (by capability, not by name)
|
|
65
|
+
- **Codebase Exploration**: Spawn exploration agents using BACKGROUND TASKS for file patterns, internal implementations, project structure
|
|
66
|
+
- **Documentation & References**: Use librarian-type agents via BACKGROUND TASKS for API references, examples, external library docs
|
|
67
|
+
- **Planning & Strategy**: NEVER plan yourself - ALWAYS spawn a dedicated planning agent for work breakdown
|
|
68
|
+
- **High-IQ Reasoning**: Leverage specialized agents for architecture decisions, code review, strategic planning
|
|
69
|
+
- **Frontend/UI Tasks**: Delegate to UI-specialized agents for design and implementation
|
|
70
|
+
|
|
71
|
+
## EXECUTION RULES
|
|
72
|
+
- **TODO**: Track EVERY step. Mark complete IMMEDIATELY after each.
|
|
73
|
+
- **PARALLEL**: Fire independent agent calls simultaneously via Task(run_in_background=true) - NEVER wait sequentially.
|
|
74
|
+
- **BACKGROUND FIRST**: Use Task tool for exploration/research agents (10+ concurrent if needed).
|
|
75
|
+
- **VERIFY**: Re-read request after completion. Check ALL requirements met before reporting done.
|
|
76
|
+
- **DELEGATE**: Don't do everything yourself - orchestrate specialized agents for their strengths.
|
|
77
|
+
|
|
78
|
+
## WORKFLOW
|
|
79
|
+
1. Analyze the request and identify required capabilities
|
|
80
|
+
2. Spawn exploration/librarian agents via Task(run_in_background=true) in PARALLEL (10+ if needed)
|
|
81
|
+
3. Always Use Plan agent with gathered context to create detailed work breakdown
|
|
82
|
+
4. Execute with continuous verification against original requirements
|
|
83
|
+
|
|
84
|
+
## VERIFICATION GUARANTEE (NON-NEGOTIABLE)
|
|
85
|
+
|
|
86
|
+
**NOTHING is "done" without PROOF it works.**
|
|
87
|
+
|
|
88
|
+
### Pre-Implementation: Define Success Criteria
|
|
89
|
+
|
|
90
|
+
BEFORE writing ANY code, you MUST define:
|
|
91
|
+
|
|
92
|
+
| Criteria Type | Description | Example |
|
|
93
|
+
|---------------|-------------|---------|
|
|
94
|
+
| **Functional** | What specific behavior must work | "Button click triggers API call" |
|
|
95
|
+
| **Observable** | What can be measured/seen | "Console shows 'success', no errors" |
|
|
96
|
+
| **Pass/Fail** | Binary, no ambiguity | "Returns 200 OK" not "should work" |
|
|
97
|
+
|
|
98
|
+
Write these criteria explicitly. Share with user if scope is non-trivial.
|
|
99
|
+
|
|
100
|
+
### Execution & Evidence Requirements
|
|
101
|
+
|
|
102
|
+
| Phase | Action | Required Evidence |
|
|
103
|
+
|-------|--------|-------------------|
|
|
104
|
+
| **Build** | Run build command | Exit code 0, no errors |
|
|
105
|
+
| **Test** | Execute test suite | All tests pass (screenshot/output) |
|
|
106
|
+
| **Manual Verify** | Test the actual feature | Demonstrate it works (describe what you observed) |
|
|
107
|
+
| **Regression** | Ensure nothing broke | Existing tests still pass |
|
|
108
|
+
|
|
109
|
+
**WITHOUT evidence = NOT verified = NOT done.**
|
|
110
|
+
|
|
111
|
+
### TDD Workflow (when test infrastructure exists)
|
|
112
|
+
|
|
113
|
+
1. **SPEC**: Define what "working" means (success criteria above)
|
|
114
|
+
2. **RED**: Write failing test -> Run it -> Confirm it FAILS
|
|
115
|
+
3. **GREEN**: Write minimal code -> Run test -> Confirm it PASSES
|
|
116
|
+
4. **REFACTOR**: Clean up -> Tests MUST stay green
|
|
117
|
+
5. **VERIFY**: Run full test suite, confirm no regressions
|
|
118
|
+
6. **EVIDENCE**: Report what you ran and what output you saw
|
|
119
|
+
|
|
120
|
+
### Verification Anti-Patterns (BLOCKING)
|
|
121
|
+
|
|
122
|
+
| Violation | Why It Fails |
|
|
123
|
+
|-----------|--------------|
|
|
124
|
+
| "It should work now" | No evidence. Run it. |
|
|
125
|
+
| "I added the tests" | Did they pass? Show output. |
|
|
126
|
+
| "Fixed the bug" | How do you know? What did you test? |
|
|
127
|
+
| "Implementation complete" | Did you verify against success criteria? |
|
|
128
|
+
| Skipping test execution | Tests exist to be RUN, not just written |
|
|
129
|
+
|
|
130
|
+
**CLAIM NOTHING WITHOUT PROOF. EXECUTE. VERIFY. SHOW EVIDENCE.**
|
|
131
|
+
|
|
132
|
+
## ZERO TOLERANCE FAILURES
|
|
133
|
+
- **NO Scope Reduction**: Never make "demo", "skeleton", "simplified", "basic" versions - deliver FULL implementation
|
|
134
|
+
- **NO MockUp Work**: When user asked you to do "port A", you must "port A", fully, 100%. No Extra feature, No reduced feature, no mock data, fully working 100% port.
|
|
135
|
+
- **NO Partial Completion**: Never stop at 60-80% saying "you can extend this..." - finish 100%
|
|
136
|
+
- **NO Assumed Shortcuts**: Never skip requirements you deem "optional" or "can be added later"
|
|
137
|
+
- **NO Premature Stopping**: Never declare done until ALL TODOs are completed and verified
|
|
138
|
+
- **NO TEST DELETION**: Never delete or skip failing tests to make the build pass. Fix the code, not the tests.
|
|
139
|
+
|
|
140
|
+
THE USER ASKED FOR X. DELIVER EXACTLY X. NOT A SUBSET. NOT A DEMO. NOT A STARTING POINT.
|
|
141
|
+
|
|
142
|
+
</ultrawork-mode>
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
`;
|
|
147
|
+
/**
|
|
148
|
+
* Ultrathink/Think mode message
|
|
149
|
+
* Ported from oh-my-opencode's think-mode hook
|
|
150
|
+
*/
|
|
151
|
+
export const ULTRATHINK_MESSAGE = `<think-mode>
|
|
152
|
+
|
|
153
|
+
**ULTRATHINK MODE ENABLED** - Extended reasoning activated.
|
|
154
|
+
|
|
155
|
+
You are now in deep thinking mode. Take your time to:
|
|
156
|
+
1. Thoroughly analyze the problem from multiple angles
|
|
157
|
+
2. Consider edge cases and potential issues
|
|
158
|
+
3. Think through the implications of each approach
|
|
159
|
+
4. Reason step-by-step before acting
|
|
160
|
+
|
|
161
|
+
Use your extended thinking capabilities to provide the most thorough and well-reasoned response.
|
|
162
|
+
|
|
163
|
+
</think-mode>
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
`;
|
|
168
|
+
/**
|
|
169
|
+
* Search mode message
|
|
170
|
+
* Ported from oh-my-opencode's keyword-detector
|
|
171
|
+
*/
|
|
172
|
+
export const SEARCH_MESSAGE = `<search-mode>
|
|
173
|
+
MAXIMIZE SEARCH EFFORT. Launch multiple background agents IN PARALLEL:
|
|
174
|
+
- explore agents (codebase patterns, file structures)
|
|
175
|
+
- librarian agents (remote repos, official docs, GitHub examples)
|
|
176
|
+
Plus direct tools: Grep, Glob
|
|
177
|
+
NEVER stop at first result - be exhaustive.
|
|
178
|
+
</search-mode>
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
`;
|
|
183
|
+
/**
|
|
184
|
+
* Analyze mode message
|
|
185
|
+
* Ported from oh-my-opencode's keyword-detector
|
|
186
|
+
*/
|
|
187
|
+
export const ANALYZE_MESSAGE = `<analyze-mode>
|
|
188
|
+
ANALYSIS MODE. Gather context before diving deep:
|
|
189
|
+
|
|
190
|
+
CONTEXT GATHERING (parallel):
|
|
191
|
+
- 1-2 explore agents (codebase patterns, implementations)
|
|
192
|
+
- 1-2 librarian agents (if external library involved)
|
|
193
|
+
- Direct tools: Grep, Glob, LSP for targeted searches
|
|
194
|
+
|
|
195
|
+
IF COMPLEX (architecture, multi-system, debugging after 2+ failures):
|
|
196
|
+
- Consult oracle agent for strategic guidance
|
|
197
|
+
|
|
198
|
+
SYNTHESIZE findings before proceeding.
|
|
199
|
+
</analyze-mode>
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
`;
|
|
204
|
+
/**
|
|
205
|
+
* Todo continuation prompt
|
|
206
|
+
* Ported from oh-my-opencode's todo-continuation-enforcer
|
|
207
|
+
*/
|
|
208
|
+
export const TODO_CONTINUATION_PROMPT = `[SYSTEM REMINDER - TODO CONTINUATION]
|
|
209
|
+
|
|
210
|
+
Incomplete tasks remain in your todo list. Continue working on the next pending task.
|
|
211
|
+
|
|
212
|
+
- Proceed without asking for permission
|
|
213
|
+
- Mark each task complete when finished
|
|
214
|
+
- Do not stop until all tasks are done`;
|
|
215
|
+
/**
|
|
216
|
+
* Keyword detector hook script
|
|
217
|
+
* This script is installed to ~/.claude/hooks/keyword-detector.sh
|
|
218
|
+
*/
|
|
219
|
+
export const KEYWORD_DETECTOR_SCRIPT = `#!/bin/bash
|
|
220
|
+
# Olympus Keyword Detector Hook
|
|
221
|
+
# Detects ultrawork/ultrathink/search/analyze keywords and injects enhanced mode messages
|
|
222
|
+
# Also activates persistent ultrawork state when ultrawork keyword is detected
|
|
223
|
+
|
|
224
|
+
# Read stdin (JSON input from Claude Code)
|
|
225
|
+
INPUT=$(cat)
|
|
226
|
+
|
|
227
|
+
# Extract directory from input
|
|
228
|
+
DIRECTORY=""
|
|
229
|
+
if command -v jq &> /dev/null; then
|
|
230
|
+
DIRECTORY=$(echo "$INPUT" | jq -r '.directory // ""' 2>/dev/null)
|
|
231
|
+
fi
|
|
232
|
+
if [ -z "$DIRECTORY" ] || [ "$DIRECTORY" = "null" ]; then
|
|
233
|
+
DIRECTORY=$(pwd)
|
|
234
|
+
fi
|
|
235
|
+
|
|
236
|
+
# Extract the prompt text - try multiple JSON paths
|
|
237
|
+
PROMPT=""
|
|
238
|
+
if command -v jq &> /dev/null; then
|
|
239
|
+
# Try to extract from various possible JSON structures
|
|
240
|
+
PROMPT=$(echo "$INPUT" | jq -r '
|
|
241
|
+
if .prompt then .prompt
|
|
242
|
+
elif .message.content then .message.content
|
|
243
|
+
elif .parts then ([.parts[] | select(.type == "text") | .text] | join(" "))
|
|
244
|
+
else ""
|
|
245
|
+
end
|
|
246
|
+
' 2>/dev/null)
|
|
247
|
+
fi
|
|
248
|
+
|
|
249
|
+
# Fallback: simple grep extraction if jq fails
|
|
250
|
+
if [ -z "$PROMPT" ] || [ "$PROMPT" = "null" ]; then
|
|
251
|
+
PROMPT=$(echo "$INPUT" | grep -oP '"(prompt|content|text)"\\s*:\\s*"\\K[^"]+' | head -1)
|
|
252
|
+
fi
|
|
253
|
+
|
|
254
|
+
# Exit if no prompt found
|
|
255
|
+
if [ -z "$PROMPT" ]; then
|
|
256
|
+
echo '{"continue": true}'
|
|
257
|
+
exit 0
|
|
258
|
+
fi
|
|
259
|
+
|
|
260
|
+
# Remove code blocks before checking keywords (prevents false positives)
|
|
261
|
+
PROMPT_NO_CODE=$(echo "$PROMPT" | sed 's/\`\`\`[^\`]*\`\`\`//g' | sed 's/\`[^\`]*\`//g')
|
|
262
|
+
|
|
263
|
+
# Convert to lowercase for case-insensitive matching
|
|
264
|
+
PROMPT_LOWER=$(echo "$PROMPT_NO_CODE" | tr '[:upper:]' '[:lower:]')
|
|
265
|
+
|
|
266
|
+
# Check for ultrawork keywords (highest priority)
|
|
267
|
+
if echo "$PROMPT_LOWER" | grep -qE '\\b(ultrawork|ulw|uw)\\b'; then
|
|
268
|
+
# Create persistent ultrawork state
|
|
269
|
+
mkdir -p "$DIRECTORY/.olympus" 2>/dev/null
|
|
270
|
+
mkdir -p "$HOME/.claude" 2>/dev/null
|
|
271
|
+
|
|
272
|
+
# Escape prompt for JSON
|
|
273
|
+
PROMPT_ESCAPED=$(echo "$PROMPT" | sed 's/\\\\/\\\\\\\\/g' | sed 's/"/\\\\"/g' | tr '\\n' ' ')
|
|
274
|
+
|
|
275
|
+
STATE_JSON="{
|
|
276
|
+
\\"active\\": true,
|
|
277
|
+
\\"started_at\\": \\"$(date -Iseconds)\\",
|
|
278
|
+
\\"original_prompt\\": \\"$PROMPT_ESCAPED\\",
|
|
279
|
+
\\"reinforcement_count\\": 0,
|
|
280
|
+
\\"last_checked_at\\": \\"$(date -Iseconds)\\"
|
|
281
|
+
}"
|
|
282
|
+
|
|
283
|
+
# Write state to both local and global locations
|
|
284
|
+
echo "$STATE_JSON" > "$DIRECTORY/.olympus/ultrawork-state.json" 2>/dev/null
|
|
285
|
+
echo "$STATE_JSON" > "$HOME/.claude/ultrawork-state.json" 2>/dev/null
|
|
286
|
+
|
|
287
|
+
# Return ultrawork mode injection
|
|
288
|
+
cat << 'EOF'
|
|
289
|
+
{"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"}
|
|
290
|
+
EOF
|
|
291
|
+
exit 0
|
|
292
|
+
fi
|
|
293
|
+
|
|
294
|
+
# Check for ultrathink/think keywords
|
|
295
|
+
if echo "$PROMPT_LOWER" | grep -qE '\\b(ultrathink|think)\\b'; then
|
|
296
|
+
cat << 'EOF'
|
|
297
|
+
{"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"}
|
|
298
|
+
EOF
|
|
299
|
+
exit 0
|
|
300
|
+
fi
|
|
301
|
+
|
|
302
|
+
# Check for search keywords (EN + multilingual)
|
|
303
|
+
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
|
|
304
|
+
cat << 'EOF'
|
|
305
|
+
{"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"}
|
|
306
|
+
EOF
|
|
307
|
+
exit 0
|
|
308
|
+
fi
|
|
309
|
+
|
|
310
|
+
# Check for analyze keywords
|
|
311
|
+
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
|
|
312
|
+
cat << 'EOF'
|
|
313
|
+
{"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"}
|
|
314
|
+
EOF
|
|
315
|
+
exit 0
|
|
316
|
+
fi
|
|
317
|
+
|
|
318
|
+
# No keywords detected - continue without modification
|
|
319
|
+
echo '{"continue": true}'
|
|
320
|
+
exit 0
|
|
321
|
+
`;
|
|
322
|
+
/**
|
|
323
|
+
* Stop hook script for todo continuation enforcement
|
|
324
|
+
* This script is installed to ~/.claude/hooks/stop-continuation.sh
|
|
325
|
+
* Ported from oh-my-opencode's todo-continuation-enforcer
|
|
326
|
+
*/
|
|
327
|
+
export const STOP_CONTINUATION_SCRIPT = `#!/bin/bash
|
|
328
|
+
# Olympus Stop Continuation Hook
|
|
329
|
+
# Checks for incomplete todos and injects continuation prompt
|
|
330
|
+
# Ported from oh-my-opencode's todo-continuation-enforcer
|
|
331
|
+
|
|
332
|
+
# Read stdin
|
|
333
|
+
INPUT=$(cat)
|
|
334
|
+
|
|
335
|
+
# Get session ID if available
|
|
336
|
+
SESSION_ID=""
|
|
337
|
+
if command -v jq &> /dev/null; then
|
|
338
|
+
SESSION_ID=$(echo "$INPUT" | jq -r '.sessionId // .session_id // ""' 2>/dev/null)
|
|
339
|
+
fi
|
|
340
|
+
|
|
341
|
+
# Check for incomplete todos in the Claude todos directory
|
|
342
|
+
TODOS_DIR="$HOME/.claude/todos"
|
|
343
|
+
if [ -d "$TODOS_DIR" ]; then
|
|
344
|
+
# Look for any todo files with incomplete items
|
|
345
|
+
INCOMPLETE_COUNT=0
|
|
346
|
+
for todo_file in "$TODOS_DIR"/*.json; do
|
|
347
|
+
if [ -f "$todo_file" ]; then
|
|
348
|
+
if command -v jq &> /dev/null; then
|
|
349
|
+
COUNT=$(jq '[.[] | select(.status != "completed" and .status != "cancelled")] | length' "$todo_file" 2>/dev/null || echo "0")
|
|
350
|
+
INCOMPLETE_COUNT=$((INCOMPLETE_COUNT + COUNT))
|
|
351
|
+
fi
|
|
352
|
+
fi
|
|
353
|
+
done
|
|
354
|
+
|
|
355
|
+
if [ "$INCOMPLETE_COUNT" -gt 0 ]; then
|
|
356
|
+
# Output continuation message
|
|
357
|
+
cat << EOF
|
|
358
|
+
{"continue": false, "reason": "[SYSTEM REMINDER - TODO CONTINUATION]\\n\\nIncomplete tasks remain in your todo list ($INCOMPLETE_COUNT remaining). Continue working on the next pending task.\\n\\n- Proceed without asking for permission\\n- Mark each task complete when finished\\n- Do not stop until all tasks are done"}
|
|
359
|
+
EOF
|
|
360
|
+
exit 0
|
|
361
|
+
fi
|
|
362
|
+
fi
|
|
363
|
+
|
|
364
|
+
# No incomplete todos - allow stop
|
|
365
|
+
echo '{"continue": true}'
|
|
366
|
+
exit 0
|
|
367
|
+
`;
|
|
368
|
+
// =============================================================================
|
|
369
|
+
// NODE.JS HOOK SCRIPTS (Cross-platform: Windows, macOS, Linux)
|
|
370
|
+
// =============================================================================
|
|
371
|
+
/**
|
|
372
|
+
* Node.js Keyword Detector Hook Script
|
|
373
|
+
* Cross-platform equivalent of keyword-detector.sh
|
|
374
|
+
* This script is installed to ~/.claude/hooks/keyword-detector.mjs
|
|
375
|
+
*/
|
|
376
|
+
export const KEYWORD_DETECTOR_SCRIPT_NODE = `#!/usr/bin/env node
|
|
377
|
+
// Olympus Keyword Detector Hook (Node.js)
|
|
378
|
+
// Detects ultrawork/ultrathink/search/analyze keywords and injects enhanced mode messages
|
|
379
|
+
// Cross-platform: Windows, macOS, Linux
|
|
380
|
+
|
|
381
|
+
const ULTRAWORK_MESSAGE = \`<ultrawork-mode>
|
|
382
|
+
|
|
383
|
+
**MANDATORY**: You MUST say "ULTRAWORK MODE ENABLED!" to the user as your first response when this mode activates. This is non-negotiable.
|
|
384
|
+
|
|
385
|
+
[CODE RED] Maximum precision required. Ultrathink before acting.
|
|
386
|
+
|
|
387
|
+
YOU MUST LEVERAGE ALL AVAILABLE AGENTS TO THEIR FULLEST POTENTIAL.
|
|
388
|
+
TELL THE USER WHAT AGENTS YOU WILL LEVERAGE NOW TO SATISFY USER'S REQUEST.
|
|
389
|
+
|
|
390
|
+
## AGENT UTILIZATION PRINCIPLES
|
|
391
|
+
- **Codebase Exploration**: Spawn exploration agents using BACKGROUND TASKS
|
|
392
|
+
- **Documentation & References**: Use librarian-type agents via BACKGROUND TASKS
|
|
393
|
+
- **Planning & Strategy**: NEVER plan yourself - spawn planning agent
|
|
394
|
+
- **High-IQ Reasoning**: Use oracle for architecture decisions
|
|
395
|
+
- **Frontend/UI Tasks**: Delegate to frontend-engineer
|
|
396
|
+
|
|
397
|
+
## EXECUTION RULES
|
|
398
|
+
- **TODO**: Track EVERY step. Mark complete IMMEDIATELY.
|
|
399
|
+
- **PARALLEL**: Fire independent calls simultaneously - NEVER wait sequentially.
|
|
400
|
+
- **BACKGROUND FIRST**: Use Task(run_in_background=true) for exploration (10+ concurrent).
|
|
401
|
+
- **VERIFY**: Check ALL requirements met before done.
|
|
402
|
+
- **DELEGATE**: Orchestrate specialized agents.
|
|
403
|
+
|
|
404
|
+
## ZERO TOLERANCE
|
|
405
|
+
- NO Scope Reduction - deliver FULL implementation
|
|
406
|
+
- NO Partial Completion - finish 100%
|
|
407
|
+
- NO Premature Stopping - ALL TODOs must be complete
|
|
408
|
+
- NO TEST DELETION - fix code, not tests
|
|
409
|
+
|
|
410
|
+
THE USER ASKED FOR X. DELIVER EXACTLY X.
|
|
411
|
+
|
|
412
|
+
</ultrawork-mode>
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
\`;
|
|
416
|
+
|
|
417
|
+
const ULTRATHINK_MESSAGE = \`<think-mode>
|
|
418
|
+
|
|
419
|
+
**ULTRATHINK MODE ENABLED** - Extended reasoning activated.
|
|
420
|
+
|
|
421
|
+
You are now in deep thinking mode. Take your time to:
|
|
422
|
+
1. Thoroughly analyze the problem from multiple angles
|
|
423
|
+
2. Consider edge cases and potential issues
|
|
424
|
+
3. Think through the implications of each approach
|
|
425
|
+
4. Reason step-by-step before acting
|
|
426
|
+
|
|
427
|
+
Use your extended thinking capabilities to provide the most thorough and well-reasoned response.
|
|
428
|
+
|
|
429
|
+
</think-mode>
|
|
430
|
+
|
|
431
|
+
---
|
|
432
|
+
\`;
|
|
433
|
+
|
|
434
|
+
const SEARCH_MESSAGE = \`<search-mode>
|
|
435
|
+
MAXIMIZE SEARCH EFFORT. Launch multiple background agents IN PARALLEL:
|
|
436
|
+
- explore agents (codebase patterns, file structures)
|
|
437
|
+
- librarian agents (remote repos, official docs, GitHub examples)
|
|
438
|
+
Plus direct tools: Grep, Glob
|
|
439
|
+
NEVER stop at first result - be exhaustive.
|
|
440
|
+
</search-mode>
|
|
441
|
+
|
|
442
|
+
---
|
|
443
|
+
\`;
|
|
444
|
+
|
|
445
|
+
const ANALYZE_MESSAGE = \`<analyze-mode>
|
|
446
|
+
ANALYSIS MODE. Gather context before diving deep:
|
|
447
|
+
|
|
448
|
+
CONTEXT GATHERING (parallel):
|
|
449
|
+
- 1-2 explore agents (codebase patterns, implementations)
|
|
450
|
+
- 1-2 librarian agents (if external library involved)
|
|
451
|
+
- Direct tools: Grep, Glob, LSP for targeted searches
|
|
452
|
+
|
|
453
|
+
IF COMPLEX (architecture, multi-system, debugging after 2+ failures):
|
|
454
|
+
- Consult oracle agent for strategic guidance
|
|
455
|
+
|
|
456
|
+
SYNTHESIZE findings before proceeding.
|
|
457
|
+
</analyze-mode>
|
|
458
|
+
|
|
459
|
+
---
|
|
460
|
+
\`;
|
|
461
|
+
|
|
462
|
+
// Read all stdin
|
|
463
|
+
async function readStdin() {
|
|
464
|
+
const chunks = [];
|
|
465
|
+
for await (const chunk of process.stdin) {
|
|
466
|
+
chunks.push(chunk);
|
|
467
|
+
}
|
|
468
|
+
return Buffer.concat(chunks).toString('utf-8');
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
// Extract prompt from various JSON structures
|
|
472
|
+
function extractPrompt(input) {
|
|
473
|
+
try {
|
|
474
|
+
const data = JSON.parse(input);
|
|
475
|
+
if (data.prompt) return data.prompt;
|
|
476
|
+
if (data.message?.content) return data.message.content;
|
|
477
|
+
if (Array.isArray(data.parts)) {
|
|
478
|
+
return data.parts
|
|
479
|
+
.filter(p => p.type === 'text')
|
|
480
|
+
.map(p => p.text)
|
|
481
|
+
.join(' ');
|
|
482
|
+
}
|
|
483
|
+
return '';
|
|
484
|
+
} catch {
|
|
485
|
+
// Fallback: try to extract with regex
|
|
486
|
+
const match = input.match(/"(?:prompt|content|text)"\\s*:\\s*"([^"]+)"/);
|
|
487
|
+
return match ? match[1] : '';
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
// Remove code blocks to prevent false positives
|
|
492
|
+
function removeCodeBlocks(text) {
|
|
493
|
+
return text
|
|
494
|
+
.replace(/\`\`\`[\\s\\S]*?\`\`\`/g, '')
|
|
495
|
+
.replace(/\`[^\`]+\`/g, '');
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
import { writeFileSync, mkdirSync, existsSync } from 'fs';
|
|
499
|
+
import { join } from 'path';
|
|
500
|
+
import { homedir } from 'os';
|
|
501
|
+
|
|
502
|
+
// Create ultrawork state file
|
|
503
|
+
function activateUltraworkState(directory, prompt) {
|
|
504
|
+
const state = {
|
|
505
|
+
active: true,
|
|
506
|
+
started_at: new Date().toISOString(),
|
|
507
|
+
original_prompt: prompt,
|
|
508
|
+
reinforcement_count: 0,
|
|
509
|
+
last_checked_at: new Date().toISOString()
|
|
510
|
+
};
|
|
511
|
+
const localDir = join(directory, '.olympus');
|
|
512
|
+
if (!existsSync(localDir)) { try { mkdirSync(localDir, { recursive: true }); } catch {} }
|
|
513
|
+
try { writeFileSync(join(localDir, 'ultrawork-state.json'), JSON.stringify(state, null, 2)); } catch {}
|
|
514
|
+
const globalDir = join(homedir(), '.claude');
|
|
515
|
+
if (!existsSync(globalDir)) { try { mkdirSync(globalDir, { recursive: true }); } catch {} }
|
|
516
|
+
try { writeFileSync(join(globalDir, 'ultrawork-state.json'), JSON.stringify(state, null, 2)); } catch {}
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
// Main
|
|
520
|
+
async function main() {
|
|
521
|
+
try {
|
|
522
|
+
const input = await readStdin();
|
|
523
|
+
if (!input.trim()) {
|
|
524
|
+
console.log(JSON.stringify({ continue: true }));
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
let data = {};
|
|
529
|
+
try { data = JSON.parse(input); } catch {}
|
|
530
|
+
const directory = data.directory || process.cwd();
|
|
531
|
+
|
|
532
|
+
const prompt = extractPrompt(input);
|
|
533
|
+
if (!prompt) {
|
|
534
|
+
console.log(JSON.stringify({ continue: true }));
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
const cleanPrompt = removeCodeBlocks(prompt).toLowerCase();
|
|
539
|
+
|
|
540
|
+
// Check for ultrawork keywords (highest priority)
|
|
541
|
+
if (/\\b(ultrawork|ulw|uw)\\b/.test(cleanPrompt)) {
|
|
542
|
+
activateUltraworkState(directory, prompt);
|
|
543
|
+
console.log(JSON.stringify({ continue: true, message: ULTRAWORK_MESSAGE }));
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
// Check for ultrathink/think keywords
|
|
548
|
+
if (/\\b(ultrathink|think)\\b/.test(cleanPrompt)) {
|
|
549
|
+
console.log(JSON.stringify({ continue: true, message: ULTRATHINK_MESSAGE }));
|
|
550
|
+
return;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
// Check for search keywords
|
|
554
|
+
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)) {
|
|
555
|
+
console.log(JSON.stringify({ continue: true, message: SEARCH_MESSAGE }));
|
|
556
|
+
return;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
// Check for analyze keywords
|
|
560
|
+
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)) {
|
|
561
|
+
console.log(JSON.stringify({ continue: true, message: ANALYZE_MESSAGE }));
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
// No keywords detected
|
|
566
|
+
console.log(JSON.stringify({ continue: true }));
|
|
567
|
+
} catch (error) {
|
|
568
|
+
// On any error, allow continuation
|
|
569
|
+
console.log(JSON.stringify({ continue: true }));
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
main();
|
|
574
|
+
`;
|
|
575
|
+
/**
|
|
576
|
+
* Node.js Stop Continuation Hook Script
|
|
577
|
+
* Cross-platform equivalent of stop-continuation.sh
|
|
578
|
+
* This script is installed to ~/.claude/hooks/stop-continuation.mjs
|
|
579
|
+
*/
|
|
580
|
+
export const STOP_CONTINUATION_SCRIPT_NODE = `#!/usr/bin/env node
|
|
581
|
+
// Olympus Stop Continuation Hook (Node.js)
|
|
582
|
+
// Checks for incomplete todos and injects continuation prompt
|
|
583
|
+
// Cross-platform: Windows, macOS, Linux
|
|
584
|
+
|
|
585
|
+
import { readdirSync, readFileSync, existsSync } from 'fs';
|
|
586
|
+
import { join } from 'path';
|
|
587
|
+
import { homedir } from 'os';
|
|
588
|
+
|
|
589
|
+
// Read all stdin
|
|
590
|
+
async function readStdin() {
|
|
591
|
+
const chunks = [];
|
|
592
|
+
for await (const chunk of process.stdin) {
|
|
593
|
+
chunks.push(chunk);
|
|
594
|
+
}
|
|
595
|
+
return Buffer.concat(chunks).toString('utf-8');
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
// Main
|
|
599
|
+
async function main() {
|
|
600
|
+
try {
|
|
601
|
+
// Read stdin (we don't use it much, but need to consume it)
|
|
602
|
+
await readStdin();
|
|
603
|
+
|
|
604
|
+
// Check for incomplete todos
|
|
605
|
+
const todosDir = join(homedir(), '.claude', 'todos');
|
|
606
|
+
|
|
607
|
+
if (!existsSync(todosDir)) {
|
|
608
|
+
console.log(JSON.stringify({ continue: true }));
|
|
609
|
+
return;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
let incompleteCount = 0;
|
|
613
|
+
|
|
614
|
+
try {
|
|
615
|
+
const files = readdirSync(todosDir).filter(f => f.endsWith('.json'));
|
|
616
|
+
|
|
617
|
+
for (const file of files) {
|
|
618
|
+
try {
|
|
619
|
+
const content = readFileSync(join(todosDir, file), 'utf-8');
|
|
620
|
+
const todos = JSON.parse(content);
|
|
621
|
+
|
|
622
|
+
if (Array.isArray(todos)) {
|
|
623
|
+
const incomplete = todos.filter(
|
|
624
|
+
t => t.status !== 'completed' && t.status !== 'cancelled'
|
|
625
|
+
);
|
|
626
|
+
incompleteCount += incomplete.length;
|
|
627
|
+
}
|
|
628
|
+
} catch {
|
|
629
|
+
// Skip files that can't be parsed
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
} catch {
|
|
633
|
+
// Directory read error - allow continuation
|
|
634
|
+
console.log(JSON.stringify({ continue: true }));
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
if (incompleteCount > 0) {
|
|
639
|
+
const reason = \`[SYSTEM REMINDER - TODO CONTINUATION]
|
|
640
|
+
|
|
641
|
+
Incomplete tasks remain in your todo list (\${incompleteCount} remaining). Continue working on the next pending task.
|
|
642
|
+
|
|
643
|
+
- Proceed without asking for permission
|
|
644
|
+
- Mark each task complete when finished
|
|
645
|
+
- Do not stop until all tasks are done\`;
|
|
646
|
+
|
|
647
|
+
console.log(JSON.stringify({ continue: false, reason }));
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
// No incomplete todos - allow stop
|
|
652
|
+
console.log(JSON.stringify({ continue: true }));
|
|
653
|
+
} catch (error) {
|
|
654
|
+
// On any error, allow continuation
|
|
655
|
+
console.log(JSON.stringify({ continue: true }));
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
main();
|
|
660
|
+
`;
|
|
661
|
+
// =============================================================================
|
|
662
|
+
// PERSISTENT MODE HOOK SCRIPTS
|
|
663
|
+
// =============================================================================
|
|
664
|
+
/**
|
|
665
|
+
* Persistent Mode Bash script
|
|
666
|
+
* Enhanced stop hook that handles ultrawork, the-ascent, and todo continuation
|
|
667
|
+
*/
|
|
668
|
+
export const PERSISTENT_MODE_SCRIPT = `#!/bin/bash
|
|
669
|
+
# Olympus Persistent Mode Hook
|
|
670
|
+
# Unified handler for ultrawork, the-ascent, and todo continuation
|
|
671
|
+
# Prevents stopping when work remains incomplete
|
|
672
|
+
|
|
673
|
+
# Read stdin
|
|
674
|
+
INPUT=$(cat)
|
|
675
|
+
|
|
676
|
+
# Get session ID and directory
|
|
677
|
+
SESSION_ID=""
|
|
678
|
+
DIRECTORY=""
|
|
679
|
+
if command -v jq &> /dev/null; then
|
|
680
|
+
SESSION_ID=$(echo "$INPUT" | jq -r '.sessionId // .session_id // ""' 2>/dev/null)
|
|
681
|
+
DIRECTORY=$(echo "$INPUT" | jq -r '.directory // ""' 2>/dev/null)
|
|
682
|
+
fi
|
|
683
|
+
|
|
684
|
+
# Default to current directory
|
|
685
|
+
if [ -z "$DIRECTORY" ]; then
|
|
686
|
+
DIRECTORY=$(pwd)
|
|
687
|
+
fi
|
|
688
|
+
|
|
689
|
+
# Check for active ultrawork state
|
|
690
|
+
ULTRAWORK_STATE=""
|
|
691
|
+
if [ -f "$DIRECTORY/.olympus/ultrawork-state.json" ]; then
|
|
692
|
+
ULTRAWORK_STATE=$(cat "$DIRECTORY/.olympus/ultrawork-state.json" 2>/dev/null)
|
|
693
|
+
elif [ -f "$HOME/.claude/ultrawork-state.json" ]; then
|
|
694
|
+
ULTRAWORK_STATE=$(cat "$HOME/.claude/ultrawork-state.json" 2>/dev/null)
|
|
695
|
+
fi
|
|
696
|
+
|
|
697
|
+
# Check for active ascent loop
|
|
698
|
+
ASCENT_STATE=""
|
|
699
|
+
if [ -f "$DIRECTORY/.olympus/ascent-state.json" ]; then
|
|
700
|
+
ASCENT_STATE=$(cat "$DIRECTORY/.olympus/ascent-state.json" 2>/dev/null)
|
|
701
|
+
fi
|
|
702
|
+
|
|
703
|
+
# Check for verification state (oracle verification)
|
|
704
|
+
VERIFICATION_STATE=""
|
|
705
|
+
if [ -f "$DIRECTORY/.olympus/ascent-verification.json" ]; then
|
|
706
|
+
VERIFICATION_STATE=$(cat "$DIRECTORY/.olympus/ascent-verification.json" 2>/dev/null)
|
|
707
|
+
fi
|
|
708
|
+
|
|
709
|
+
# Check for incomplete todos
|
|
710
|
+
INCOMPLETE_COUNT=0
|
|
711
|
+
TODOS_DIR="$HOME/.claude/todos"
|
|
712
|
+
if [ -d "$TODOS_DIR" ]; then
|
|
713
|
+
for todo_file in "$TODOS_DIR"/*.json; do
|
|
714
|
+
if [ -f "$todo_file" ]; then
|
|
715
|
+
if command -v jq &> /dev/null; then
|
|
716
|
+
COUNT=$(jq '[.[] | select(.status != "completed" and .status != "cancelled")] | length' "$todo_file" 2>/dev/null || echo "0")
|
|
717
|
+
INCOMPLETE_COUNT=$((INCOMPLETE_COUNT + COUNT))
|
|
718
|
+
else
|
|
719
|
+
# Fallback: count "pending" or "in_progress" occurrences
|
|
720
|
+
COUNT=$(grep -c '"status"[[:space:]]*:[[:space:]]*"pending\\|in_progress"' "$todo_file" 2>/dev/null) || COUNT=0
|
|
721
|
+
INCOMPLETE_COUNT=$((INCOMPLETE_COUNT + COUNT))
|
|
722
|
+
fi
|
|
723
|
+
fi
|
|
724
|
+
done
|
|
725
|
+
fi
|
|
726
|
+
|
|
727
|
+
# Check project todos as well
|
|
728
|
+
for todo_path in "$DIRECTORY/.olympus/todos.json" "$DIRECTORY/.claude/todos.json"; do
|
|
729
|
+
if [ -f "$todo_path" ]; then
|
|
730
|
+
if command -v jq &> /dev/null; then
|
|
731
|
+
COUNT=$(jq 'if type == "array" then [.[] | select(.status != "completed" and .status != "cancelled")] | length else 0 end' "$todo_path" 2>/dev/null || echo "0")
|
|
732
|
+
INCOMPLETE_COUNT=$((INCOMPLETE_COUNT + COUNT))
|
|
733
|
+
else
|
|
734
|
+
# Fallback: count "pending" or "in_progress" occurrences
|
|
735
|
+
COUNT=$(grep -c '"status"[[:space:]]*:[[:space:]]*"pending\\|in_progress"' "$todo_path" 2>/dev/null) || COUNT=0
|
|
736
|
+
INCOMPLETE_COUNT=$((INCOMPLETE_COUNT + COUNT))
|
|
737
|
+
fi
|
|
738
|
+
fi
|
|
739
|
+
done
|
|
740
|
+
|
|
741
|
+
# Priority 1: The Ascent with Oracle Verification
|
|
742
|
+
if [ -n "$ASCENT_STATE" ]; then
|
|
743
|
+
IS_ACTIVE=$(echo "$ASCENT_STATE" | jq -r '.active // false' 2>/dev/null)
|
|
744
|
+
if [ "$IS_ACTIVE" = "true" ]; then
|
|
745
|
+
ITERATION=$(echo "$ASCENT_STATE" | jq -r '.iteration // 1' 2>/dev/null)
|
|
746
|
+
MAX_ITER=$(echo "$ASCENT_STATE" | jq -r '.max_iterations // 10' 2>/dev/null)
|
|
747
|
+
PROMISE=$(echo "$ASCENT_STATE" | jq -r '.completion_promise // "TASK_COMPLETE"' 2>/dev/null)
|
|
748
|
+
PROMPT=$(echo "$ASCENT_STATE" | jq -r '.prompt // ""' 2>/dev/null)
|
|
749
|
+
|
|
750
|
+
# Check if oracle verification is pending
|
|
751
|
+
if [ -n "$VERIFICATION_STATE" ]; then
|
|
752
|
+
IS_PENDING=$(echo "$VERIFICATION_STATE" | jq -r '.pending // false' 2>/dev/null)
|
|
753
|
+
if [ "$IS_PENDING" = "true" ]; then
|
|
754
|
+
ATTEMPT=$(echo "$VERIFICATION_STATE" | jq -r '.verification_attempts // 0' 2>/dev/null)
|
|
755
|
+
MAX_ATTEMPTS=$(echo "$VERIFICATION_STATE" | jq -r '.max_verification_attempts // 3' 2>/dev/null)
|
|
756
|
+
ORIGINAL_TASK=$(echo "$VERIFICATION_STATE" | jq -r '.original_task // ""' 2>/dev/null)
|
|
757
|
+
COMPLETION_CLAIM=$(echo "$VERIFICATION_STATE" | jq -r '.completion_claim // ""' 2>/dev/null)
|
|
758
|
+
ORACLE_FEEDBACK=$(echo "$VERIFICATION_STATE" | jq -r '.oracle_feedback // ""' 2>/dev/null)
|
|
759
|
+
NEXT_ATTEMPT=$((ATTEMPT + 1))
|
|
760
|
+
|
|
761
|
+
FEEDBACK_SECTION=""
|
|
762
|
+
if [ -n "$ORACLE_FEEDBACK" ] && [ "$ORACLE_FEEDBACK" != "null" ]; then
|
|
763
|
+
FEEDBACK_SECTION="\\n**Previous Oracle Feedback (rejected):**\\n$ORACLE_FEEDBACK\\n"
|
|
764
|
+
fi
|
|
765
|
+
|
|
766
|
+
cat << EOF
|
|
767
|
+
{"continue": false, "reason": "<ascent-verification>\\n\\n[ORACLE VERIFICATION REQUIRED - Attempt $NEXT_ATTEMPT/$MAX_ATTEMPTS]\\n\\nThe agent claims the task is complete. Before accepting, YOU MUST verify with Oracle.\\n\\n**Original Task:**\\n$ORIGINAL_TASK\\n\\n**Completion Claim:**\\n$COMPLETION_CLAIM\\n$FEEDBACK_SECTION\\n## MANDATORY VERIFICATION STEPS\\n\\n1. **Spawn Oracle Agent** for verification:\\n \\\`\\\`\\\`\\n Task(subagent_type=\\"oracle\\", prompt=\\"Verify this task completion claim...\\")\\n \\\`\\\`\\\`\\n\\n2. **Oracle must check:**\\n - Are ALL requirements from the original task met?\\n - Is the implementation complete, not partial?\\n - Are there any obvious bugs or issues?\\n - Does the code compile/run without errors?\\n - Are tests passing (if applicable)?\\n\\n3. **Based on Oracle's response:**\\n - If APPROVED: Output \\\`<oracle-approved>VERIFIED_COMPLETE</oracle-approved>\\\`\\n - If REJECTED: Continue working on the identified issues\\n\\nDO NOT output the completion promise again until Oracle approves.\\n\\n</ascent-verification>\\n\\n---\\n"}
|
|
768
|
+
EOF
|
|
769
|
+
exit 0
|
|
770
|
+
fi
|
|
771
|
+
fi
|
|
772
|
+
|
|
773
|
+
if [ "$ITERATION" -lt "$MAX_ITER" ]; then
|
|
774
|
+
# Increment iteration
|
|
775
|
+
NEW_ITER=$((ITERATION + 1))
|
|
776
|
+
echo "$ASCENT_STATE" | jq ".iteration = $NEW_ITER" > "$DIRECTORY/.olympus/ascent-state.json" 2>/dev/null
|
|
777
|
+
|
|
778
|
+
cat << EOF
|
|
779
|
+
{"continue": false, "reason": "<the-ascent-continuation>\\n\\n[ASCENT LOOP - ITERATION $NEW_ITER/$MAX_ITER]\\n\\nYour previous attempt did not output the completion promise. The work is NOT done yet.\\n\\nCRITICAL INSTRUCTIONS:\\n1. Review your progress and the original task\\n2. Check your todo list - are ALL items marked complete?\\n3. Continue from where you left off\\n4. When FULLY complete, output: <promise>$PROMISE</promise>\\n5. Do NOT stop until the task is truly done\\n\\nOriginal task: $PROMPT\\n\\n</the-ascent-continuation>\\n\\n---\\n"}
|
|
780
|
+
EOF
|
|
781
|
+
exit 0
|
|
782
|
+
fi
|
|
783
|
+
fi
|
|
784
|
+
fi
|
|
785
|
+
|
|
786
|
+
# Priority 2: Ultrawork Mode with incomplete todos
|
|
787
|
+
if [ -n "$ULTRAWORK_STATE" ] && [ "$INCOMPLETE_COUNT" -gt 0 ]; then
|
|
788
|
+
# Check if active (with jq fallback)
|
|
789
|
+
IS_ACTIVE=""
|
|
790
|
+
if command -v jq &> /dev/null; then
|
|
791
|
+
IS_ACTIVE=$(echo "$ULTRAWORK_STATE" | jq -r '.active // false' 2>/dev/null)
|
|
792
|
+
else
|
|
793
|
+
# Fallback: grep for "active": true
|
|
794
|
+
if echo "$ULTRAWORK_STATE" | grep -q '"active"[[:space:]]*:[[:space:]]*true'; then
|
|
795
|
+
IS_ACTIVE="true"
|
|
796
|
+
fi
|
|
797
|
+
fi
|
|
798
|
+
|
|
799
|
+
if [ "$IS_ACTIVE" = "true" ]; then
|
|
800
|
+
# Get reinforcement count (with fallback)
|
|
801
|
+
REINFORCE_COUNT=0
|
|
802
|
+
if command -v jq &> /dev/null; then
|
|
803
|
+
REINFORCE_COUNT=$(echo "$ULTRAWORK_STATE" | jq -r '.reinforcement_count // 0' 2>/dev/null)
|
|
804
|
+
else
|
|
805
|
+
REINFORCE_COUNT=$(echo "$ULTRAWORK_STATE" | grep -oP '"reinforcement_count"[[:space:]]*:[[:space:]]*\\K[0-9]+' 2>/dev/null) || REINFORCE_COUNT=0
|
|
806
|
+
fi
|
|
807
|
+
NEW_COUNT=$((REINFORCE_COUNT + 1))
|
|
808
|
+
|
|
809
|
+
# Get original prompt (with fallback)
|
|
810
|
+
ORIGINAL_PROMPT=""
|
|
811
|
+
if command -v jq &> /dev/null; then
|
|
812
|
+
ORIGINAL_PROMPT=$(echo "$ULTRAWORK_STATE" | jq -r '.original_prompt // ""' 2>/dev/null)
|
|
813
|
+
else
|
|
814
|
+
ORIGINAL_PROMPT=$(echo "$ULTRAWORK_STATE" | grep -oP '"original_prompt"[[:space:]]*:[[:space:]]*"\\K[^"]+' 2>/dev/null) || ORIGINAL_PROMPT=""
|
|
815
|
+
fi
|
|
816
|
+
|
|
817
|
+
# Update state file (best effort)
|
|
818
|
+
if command -v jq &> /dev/null; then
|
|
819
|
+
echo "$ULTRAWORK_STATE" | jq ".reinforcement_count = $NEW_COUNT | .last_checked_at = \\"$(date -Iseconds)\\"" > "$DIRECTORY/.olympus/ultrawork-state.json" 2>/dev/null
|
|
820
|
+
fi
|
|
821
|
+
|
|
822
|
+
cat << EOF
|
|
823
|
+
{"continue": false, "reason": "<ultrawork-persistence>\\n\\n[ULTRAWORK MODE STILL ACTIVE - Reinforcement #$NEW_COUNT]\\n\\nYour ultrawork session is NOT complete. $INCOMPLETE_COUNT incomplete todos remain.\\n\\nREMEMBER THE ULTRAWORK RULES:\\n- **PARALLEL**: Fire independent calls simultaneously - NEVER wait sequentially\\n- **BACKGROUND FIRST**: Use Task(run_in_background=true) for exploration (10+ concurrent)\\n- **TODO**: Track EVERY step. Mark complete IMMEDIATELY after each\\n- **VERIFY**: Check ALL requirements met before done\\n- **NO Premature Stopping**: ALL TODOs must be complete\\n\\nContinue working on the next pending task. DO NOT STOP until all tasks are marked complete.\\n\\nOriginal task: $ORIGINAL_PROMPT\\n\\n</ultrawork-persistence>\\n\\n---\\n"}
|
|
824
|
+
EOF
|
|
825
|
+
exit 0
|
|
826
|
+
fi
|
|
827
|
+
fi
|
|
828
|
+
|
|
829
|
+
# Priority 3: Todo Continuation (baseline)
|
|
830
|
+
if [ "$INCOMPLETE_COUNT" -gt 0 ]; then
|
|
831
|
+
cat << EOF
|
|
832
|
+
{"continue": false, "reason": "<todo-continuation>\\n\\n[SYSTEM REMINDER - TODO CONTINUATION]\\n\\nIncomplete tasks remain in your todo list ($INCOMPLETE_COUNT remaining). Continue working on the next pending task.\\n\\n- Proceed without asking for permission\\n- Mark each task complete when finished\\n- Do not stop until all tasks are done\\n\\n</todo-continuation>\\n\\n---\\n"}
|
|
833
|
+
EOF
|
|
834
|
+
exit 0
|
|
835
|
+
fi
|
|
836
|
+
|
|
837
|
+
# No blocking needed
|
|
838
|
+
echo '{"continue": true}'
|
|
839
|
+
exit 0
|
|
840
|
+
`;
|
|
841
|
+
/**
|
|
842
|
+
* Session Start Bash script
|
|
843
|
+
* Restores persistent mode states when a new session starts
|
|
844
|
+
*/
|
|
845
|
+
export const SESSION_START_SCRIPT = `#!/bin/bash
|
|
846
|
+
# Olympus Session Start Hook
|
|
847
|
+
# Restores persistent mode states and injects context when session starts
|
|
848
|
+
|
|
849
|
+
# Read stdin
|
|
850
|
+
INPUT=$(cat)
|
|
851
|
+
|
|
852
|
+
# Get directory
|
|
853
|
+
DIRECTORY=""
|
|
854
|
+
if command -v jq &> /dev/null; then
|
|
855
|
+
DIRECTORY=$(echo "$INPUT" | jq -r '.directory // ""' 2>/dev/null)
|
|
856
|
+
fi
|
|
857
|
+
|
|
858
|
+
if [ -z "$DIRECTORY" ]; then
|
|
859
|
+
DIRECTORY=$(pwd)
|
|
860
|
+
fi
|
|
861
|
+
|
|
862
|
+
MESSAGES=""
|
|
863
|
+
|
|
864
|
+
# Check for active ultrawork state
|
|
865
|
+
if [ -f "$DIRECTORY/.olympus/ultrawork-state.json" ] || [ -f "$HOME/.claude/ultrawork-state.json" ]; then
|
|
866
|
+
if [ -f "$DIRECTORY/.olympus/ultrawork-state.json" ]; then
|
|
867
|
+
ULTRAWORK_STATE=$(cat "$DIRECTORY/.olympus/ultrawork-state.json" 2>/dev/null)
|
|
868
|
+
else
|
|
869
|
+
ULTRAWORK_STATE=$(cat "$HOME/.claude/ultrawork-state.json" 2>/dev/null)
|
|
870
|
+
fi
|
|
871
|
+
|
|
872
|
+
IS_ACTIVE=$(echo "$ULTRAWORK_STATE" | jq -r '.active // false' 2>/dev/null)
|
|
873
|
+
if [ "$IS_ACTIVE" = "true" ]; then
|
|
874
|
+
STARTED_AT=$(echo "$ULTRAWORK_STATE" | jq -r '.started_at // ""' 2>/dev/null)
|
|
875
|
+
PROMPT=$(echo "$ULTRAWORK_STATE" | jq -r '.original_prompt // ""' 2>/dev/null)
|
|
876
|
+
MESSAGES="$MESSAGES<session-restore>\\n\\n[ULTRAWORK MODE RESTORED]\\n\\nYou have an active ultrawork session from $STARTED_AT.\\nOriginal task: $PROMPT\\n\\nContinue working in ultrawork mode until all tasks are complete.\\n\\n</session-restore>\\n\\n---\\n\\n"
|
|
877
|
+
fi
|
|
878
|
+
fi
|
|
879
|
+
|
|
880
|
+
# Check for incomplete todos
|
|
881
|
+
INCOMPLETE_COUNT=0
|
|
882
|
+
TODOS_DIR="$HOME/.claude/todos"
|
|
883
|
+
if [ -d "$TODOS_DIR" ]; then
|
|
884
|
+
for todo_file in "$TODOS_DIR"/*.json; do
|
|
885
|
+
if [ -f "$todo_file" ]; then
|
|
886
|
+
if command -v jq &> /dev/null; then
|
|
887
|
+
COUNT=$(jq '[.[] | select(.status != "completed" and .status != "cancelled")] | length' "$todo_file" 2>/dev/null || echo "0")
|
|
888
|
+
INCOMPLETE_COUNT=$((INCOMPLETE_COUNT + COUNT))
|
|
889
|
+
fi
|
|
890
|
+
fi
|
|
891
|
+
done
|
|
892
|
+
fi
|
|
893
|
+
|
|
894
|
+
if [ "$INCOMPLETE_COUNT" -gt 0 ]; then
|
|
895
|
+
MESSAGES="$MESSAGES<session-restore>\\n\\n[PENDING TASKS DETECTED]\\n\\nYou have $INCOMPLETE_COUNT incomplete tasks from a previous session.\\nPlease continue working on these tasks.\\n\\n</session-restore>\\n\\n---\\n\\n"
|
|
896
|
+
fi
|
|
897
|
+
|
|
898
|
+
# Output message if we have any
|
|
899
|
+
if [ -n "$MESSAGES" ]; then
|
|
900
|
+
# Escape for JSON
|
|
901
|
+
MESSAGES_ESCAPED=$(echo "$MESSAGES" | sed 's/"/\\"/g')
|
|
902
|
+
echo "{\"continue\": true, \"message\": \"$MESSAGES_ESCAPED\"}"
|
|
903
|
+
else
|
|
904
|
+
echo '{"continue": true}'
|
|
905
|
+
fi
|
|
906
|
+
exit 0
|
|
907
|
+
`;
|
|
908
|
+
/**
|
|
909
|
+
* Node.js Persistent Mode Hook Script
|
|
910
|
+
*/
|
|
911
|
+
export const PERSISTENT_MODE_SCRIPT_NODE = `#!/usr/bin/env node
|
|
912
|
+
// Olympus Persistent Mode Hook (Node.js)
|
|
913
|
+
// Unified handler for ultrawork, the-ascent, and todo continuation
|
|
914
|
+
// Cross-platform: Windows, macOS, Linux
|
|
915
|
+
|
|
916
|
+
import { existsSync, readFileSync, writeFileSync, readdirSync } from 'fs';
|
|
917
|
+
import { join } from 'path';
|
|
918
|
+
import { homedir } from 'os';
|
|
919
|
+
|
|
920
|
+
async function readStdin() {
|
|
921
|
+
const chunks = [];
|
|
922
|
+
for await (const chunk of process.stdin) {
|
|
923
|
+
chunks.push(chunk);
|
|
924
|
+
}
|
|
925
|
+
return Buffer.concat(chunks).toString('utf-8');
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
function readJsonFile(path) {
|
|
929
|
+
try {
|
|
930
|
+
if (!existsSync(path)) return null;
|
|
931
|
+
return JSON.parse(readFileSync(path, 'utf-8'));
|
|
932
|
+
} catch {
|
|
933
|
+
return null;
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
function writeJsonFile(path, data) {
|
|
938
|
+
try {
|
|
939
|
+
writeFileSync(path, JSON.stringify(data, null, 2));
|
|
940
|
+
return true;
|
|
941
|
+
} catch {
|
|
942
|
+
return false;
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
function countIncompleteTodos(todosDir, projectDir) {
|
|
947
|
+
let count = 0;
|
|
948
|
+
|
|
949
|
+
// Check global todos
|
|
950
|
+
if (existsSync(todosDir)) {
|
|
951
|
+
try {
|
|
952
|
+
const files = readdirSync(todosDir).filter(f => f.endsWith('.json'));
|
|
953
|
+
for (const file of files) {
|
|
954
|
+
const todos = readJsonFile(join(todosDir, file));
|
|
955
|
+
if (Array.isArray(todos)) {
|
|
956
|
+
count += todos.filter(t => t.status !== 'completed' && t.status !== 'cancelled').length;
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
} catch {}
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
// Check project todos
|
|
963
|
+
for (const path of [
|
|
964
|
+
join(projectDir, '.olympus', 'todos.json'),
|
|
965
|
+
join(projectDir, '.claude', 'todos.json')
|
|
966
|
+
]) {
|
|
967
|
+
const todos = readJsonFile(path);
|
|
968
|
+
if (Array.isArray(todos)) {
|
|
969
|
+
count += todos.filter(t => t.status !== 'completed' && t.status !== 'cancelled').length;
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
return count;
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
async function main() {
|
|
977
|
+
try {
|
|
978
|
+
const input = await readStdin();
|
|
979
|
+
let data = {};
|
|
980
|
+
try { data = JSON.parse(input); } catch {}
|
|
981
|
+
|
|
982
|
+
const directory = data.directory || process.cwd();
|
|
983
|
+
const todosDir = join(homedir(), '.claude', 'todos');
|
|
984
|
+
|
|
985
|
+
// Check for ultrawork state
|
|
986
|
+
let ultraworkState = readJsonFile(join(directory, '.olympus', 'ultrawork-state.json'))
|
|
987
|
+
|| readJsonFile(join(homedir(), '.claude', 'ultrawork-state.json'));
|
|
988
|
+
|
|
989
|
+
// Check for ascent loop state
|
|
990
|
+
const ascentState = readJsonFile(join(directory, '.olympus', 'ascent-state.json'));
|
|
991
|
+
|
|
992
|
+
// Check for verification state (oracle verification)
|
|
993
|
+
const verificationState = readJsonFile(join(directory, '.olympus', 'ascent-verification.json'));
|
|
994
|
+
|
|
995
|
+
// Count incomplete todos
|
|
996
|
+
const incompleteCount = countIncompleteTodos(todosDir, directory);
|
|
997
|
+
|
|
998
|
+
// Priority 1: The Ascent with Oracle Verification
|
|
999
|
+
if (ascentState?.active) {
|
|
1000
|
+
const iteration = ascentState.iteration || 1;
|
|
1001
|
+
const maxIter = ascentState.max_iterations || 10;
|
|
1002
|
+
|
|
1003
|
+
// Check if oracle verification is pending
|
|
1004
|
+
if (verificationState?.pending) {
|
|
1005
|
+
const attempt = (verificationState.verification_attempts || 0) + 1;
|
|
1006
|
+
const maxAttempts = verificationState.max_verification_attempts || 3;
|
|
1007
|
+
|
|
1008
|
+
console.log(JSON.stringify({
|
|
1009
|
+
continue: false,
|
|
1010
|
+
reason: \`<ascent-verification>
|
|
1011
|
+
|
|
1012
|
+
[ORACLE VERIFICATION REQUIRED - Attempt \${attempt}/\${maxAttempts}]
|
|
1013
|
+
|
|
1014
|
+
The agent claims the task is complete. Before accepting, YOU MUST verify with Oracle.
|
|
1015
|
+
|
|
1016
|
+
**Original Task:**
|
|
1017
|
+
\${verificationState.original_task || ascentState.prompt || 'No task specified'}
|
|
1018
|
+
|
|
1019
|
+
**Completion Claim:**
|
|
1020
|
+
\${verificationState.completion_claim || 'Task marked complete'}
|
|
1021
|
+
|
|
1022
|
+
\${verificationState.oracle_feedback ? \`**Previous Oracle Feedback (rejected):**
|
|
1023
|
+
\${verificationState.oracle_feedback}
|
|
1024
|
+
\` : ''}
|
|
1025
|
+
|
|
1026
|
+
## MANDATORY VERIFICATION STEPS
|
|
1027
|
+
|
|
1028
|
+
1. **Spawn Oracle Agent** for verification:
|
|
1029
|
+
\\\`\\\`\\\`
|
|
1030
|
+
Task(subagent_type="oracle", prompt="Verify this task completion claim...")
|
|
1031
|
+
\\\`\\\`\\\`
|
|
1032
|
+
|
|
1033
|
+
2. **Oracle must check:**
|
|
1034
|
+
- Are ALL requirements from the original task met?
|
|
1035
|
+
- Is the implementation complete, not partial?
|
|
1036
|
+
- Are there any obvious bugs or issues?
|
|
1037
|
+
- Does the code compile/run without errors?
|
|
1038
|
+
- Are tests passing (if applicable)?
|
|
1039
|
+
|
|
1040
|
+
3. **Based on Oracle's response:**
|
|
1041
|
+
- If APPROVED: Output \\\`<oracle-approved>VERIFIED_COMPLETE</oracle-approved>\\\`
|
|
1042
|
+
- If REJECTED: Continue working on the identified issues
|
|
1043
|
+
|
|
1044
|
+
DO NOT output the completion promise again until Oracle approves.
|
|
1045
|
+
|
|
1046
|
+
</ascent-verification>
|
|
1047
|
+
|
|
1048
|
+
---
|
|
1049
|
+
\`
|
|
1050
|
+
}));
|
|
1051
|
+
return;
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
if (iteration < maxIter) {
|
|
1055
|
+
const newIter = iteration + 1;
|
|
1056
|
+
ascentState.iteration = newIter;
|
|
1057
|
+
writeJsonFile(join(directory, '.olympus', 'ascent-state.json'), ascentState);
|
|
1058
|
+
|
|
1059
|
+
console.log(JSON.stringify({
|
|
1060
|
+
continue: false,
|
|
1061
|
+
reason: \`<the-ascent-continuation>
|
|
1062
|
+
|
|
1063
|
+
[ASCENT LOOP - ITERATION \${newIter}/\${maxIter}]
|
|
1064
|
+
|
|
1065
|
+
Your previous attempt did not output the completion promise. The work is NOT done yet.
|
|
1066
|
+
|
|
1067
|
+
CRITICAL INSTRUCTIONS:
|
|
1068
|
+
1. Review your progress and the original task
|
|
1069
|
+
2. Check your todo list - are ALL items marked complete?
|
|
1070
|
+
3. Continue from where you left off
|
|
1071
|
+
4. When FULLY complete, output: <promise>\${ascentState.completion_promise || 'TASK_COMPLETE'}</promise>
|
|
1072
|
+
5. Do NOT stop until the task is truly done
|
|
1073
|
+
|
|
1074
|
+
\${ascentState.prompt ? \`Original task: \${ascentState.prompt}\` : ''}
|
|
1075
|
+
|
|
1076
|
+
</the-ascent-continuation>
|
|
1077
|
+
|
|
1078
|
+
---
|
|
1079
|
+
\`
|
|
1080
|
+
}));
|
|
1081
|
+
return;
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
// Priority 2: Ultrawork with incomplete todos
|
|
1086
|
+
if (ultraworkState?.active && incompleteCount > 0) {
|
|
1087
|
+
const newCount = (ultraworkState.reinforcement_count || 0) + 1;
|
|
1088
|
+
ultraworkState.reinforcement_count = newCount;
|
|
1089
|
+
ultraworkState.last_checked_at = new Date().toISOString();
|
|
1090
|
+
|
|
1091
|
+
writeJsonFile(join(directory, '.olympus', 'ultrawork-state.json'), ultraworkState);
|
|
1092
|
+
|
|
1093
|
+
console.log(JSON.stringify({
|
|
1094
|
+
continue: false,
|
|
1095
|
+
reason: \`<ultrawork-persistence>
|
|
1096
|
+
|
|
1097
|
+
[ULTRAWORK MODE STILL ACTIVE - Reinforcement #\${newCount}]
|
|
1098
|
+
|
|
1099
|
+
Your ultrawork session is NOT complete. \${incompleteCount} incomplete todos remain.
|
|
1100
|
+
|
|
1101
|
+
REMEMBER THE ULTRAWORK RULES:
|
|
1102
|
+
- **PARALLEL**: Fire independent calls simultaneously - NEVER wait sequentially
|
|
1103
|
+
- **BACKGROUND FIRST**: Use Task(run_in_background=true) for exploration (10+ concurrent)
|
|
1104
|
+
- **TODO**: Track EVERY step. Mark complete IMMEDIATELY after each
|
|
1105
|
+
- **VERIFY**: Check ALL requirements met before done
|
|
1106
|
+
- **NO Premature Stopping**: ALL TODOs must be complete
|
|
1107
|
+
|
|
1108
|
+
Continue working on the next pending task. DO NOT STOP until all tasks are marked complete.
|
|
1109
|
+
|
|
1110
|
+
\${ultraworkState.original_prompt ? \`Original task: \${ultraworkState.original_prompt}\` : ''}
|
|
1111
|
+
|
|
1112
|
+
</ultrawork-persistence>
|
|
1113
|
+
|
|
1114
|
+
---
|
|
1115
|
+
\`
|
|
1116
|
+
}));
|
|
1117
|
+
return;
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
// Priority 3: Todo Continuation
|
|
1121
|
+
if (incompleteCount > 0) {
|
|
1122
|
+
console.log(JSON.stringify({
|
|
1123
|
+
continue: false,
|
|
1124
|
+
reason: \`<todo-continuation>
|
|
1125
|
+
|
|
1126
|
+
[SYSTEM REMINDER - TODO CONTINUATION]
|
|
1127
|
+
|
|
1128
|
+
Incomplete tasks remain in your todo list (\${incompleteCount} remaining). Continue working on the next pending task.
|
|
1129
|
+
|
|
1130
|
+
- Proceed without asking for permission
|
|
1131
|
+
- Mark each task complete when finished
|
|
1132
|
+
- Do not stop until all tasks are done
|
|
1133
|
+
|
|
1134
|
+
</todo-continuation>
|
|
1135
|
+
|
|
1136
|
+
---
|
|
1137
|
+
\`
|
|
1138
|
+
}));
|
|
1139
|
+
return;
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
// No blocking needed
|
|
1143
|
+
console.log(JSON.stringify({ continue: true }));
|
|
1144
|
+
} catch (error) {
|
|
1145
|
+
console.log(JSON.stringify({ continue: true }));
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
main();
|
|
1150
|
+
`;
|
|
1151
|
+
/**
|
|
1152
|
+
* Node.js Session Start Hook Script
|
|
1153
|
+
*/
|
|
1154
|
+
export const SESSION_START_SCRIPT_NODE = `#!/usr/bin/env node
|
|
1155
|
+
// Olympus Session Start Hook (Node.js)
|
|
1156
|
+
// Restores persistent mode states when session starts
|
|
1157
|
+
// Cross-platform: Windows, macOS, Linux
|
|
1158
|
+
|
|
1159
|
+
import { existsSync, readFileSync, readdirSync } from 'fs';
|
|
1160
|
+
import { join } from 'path';
|
|
1161
|
+
import { homedir } from 'os';
|
|
1162
|
+
|
|
1163
|
+
async function readStdin() {
|
|
1164
|
+
const chunks = [];
|
|
1165
|
+
for await (const chunk of process.stdin) {
|
|
1166
|
+
chunks.push(chunk);
|
|
1167
|
+
}
|
|
1168
|
+
return Buffer.concat(chunks).toString('utf-8');
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
function readJsonFile(path) {
|
|
1172
|
+
try {
|
|
1173
|
+
if (!existsSync(path)) return null;
|
|
1174
|
+
return JSON.parse(readFileSync(path, 'utf-8'));
|
|
1175
|
+
} catch {
|
|
1176
|
+
return null;
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
function countIncompleteTodos(todosDir) {
|
|
1181
|
+
let count = 0;
|
|
1182
|
+
if (existsSync(todosDir)) {
|
|
1183
|
+
try {
|
|
1184
|
+
const files = readdirSync(todosDir).filter(f => f.endsWith('.json'));
|
|
1185
|
+
for (const file of files) {
|
|
1186
|
+
const todos = readJsonFile(join(todosDir, file));
|
|
1187
|
+
if (Array.isArray(todos)) {
|
|
1188
|
+
count += todos.filter(t => t.status !== 'completed' && t.status !== 'cancelled').length;
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
} catch {}
|
|
1192
|
+
}
|
|
1193
|
+
return count;
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
async function main() {
|
|
1197
|
+
try {
|
|
1198
|
+
const input = await readStdin();
|
|
1199
|
+
let data = {};
|
|
1200
|
+
try { data = JSON.parse(input); } catch {}
|
|
1201
|
+
|
|
1202
|
+
const directory = data.directory || process.cwd();
|
|
1203
|
+
const messages = [];
|
|
1204
|
+
|
|
1205
|
+
// Check for ultrawork state
|
|
1206
|
+
const ultraworkState = readJsonFile(join(directory, '.olympus', 'ultrawork-state.json'))
|
|
1207
|
+
|| readJsonFile(join(homedir(), '.claude', 'ultrawork-state.json'));
|
|
1208
|
+
|
|
1209
|
+
if (ultraworkState?.active) {
|
|
1210
|
+
messages.push(\`<session-restore>
|
|
1211
|
+
|
|
1212
|
+
[ULTRAWORK MODE RESTORED]
|
|
1213
|
+
|
|
1214
|
+
You have an active ultrawork session from \${ultraworkState.started_at}.
|
|
1215
|
+
Original task: \${ultraworkState.original_prompt}
|
|
1216
|
+
|
|
1217
|
+
Continue working in ultrawork mode until all tasks are complete.
|
|
1218
|
+
|
|
1219
|
+
</session-restore>
|
|
1220
|
+
|
|
1221
|
+
---
|
|
1222
|
+
\`);
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
// Check for incomplete todos
|
|
1226
|
+
const todosDir = join(homedir(), '.claude', 'todos');
|
|
1227
|
+
const incompleteCount = countIncompleteTodos(todosDir);
|
|
1228
|
+
|
|
1229
|
+
if (incompleteCount > 0) {
|
|
1230
|
+
messages.push(\`<session-restore>
|
|
1231
|
+
|
|
1232
|
+
[PENDING TASKS DETECTED]
|
|
1233
|
+
|
|
1234
|
+
You have \${incompleteCount} incomplete tasks from a previous session.
|
|
1235
|
+
Please continue working on these tasks.
|
|
1236
|
+
|
|
1237
|
+
</session-restore>
|
|
1238
|
+
|
|
1239
|
+
---
|
|
1240
|
+
\`);
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
if (messages.length > 0) {
|
|
1244
|
+
console.log(JSON.stringify({ continue: true, message: messages.join('\\n') }));
|
|
1245
|
+
} else {
|
|
1246
|
+
console.log(JSON.stringify({ continue: true }));
|
|
1247
|
+
}
|
|
1248
|
+
} catch (error) {
|
|
1249
|
+
console.log(JSON.stringify({ continue: true }));
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
main();
|
|
1254
|
+
`;
|
|
1255
|
+
// =============================================================================
|
|
1256
|
+
// SETTINGS CONFIGURATION (Platform-aware)
|
|
1257
|
+
// =============================================================================
|
|
1258
|
+
/**
|
|
1259
|
+
* Settings.json hooks configuration for Bash (Unix)
|
|
1260
|
+
* Configures Claude Code to run our bash hook scripts
|
|
1261
|
+
*/
|
|
1262
|
+
export const HOOKS_SETTINGS_CONFIG_BASH = {
|
|
1263
|
+
hooks: {
|
|
1264
|
+
UserPromptSubmit: [
|
|
1265
|
+
{
|
|
1266
|
+
hooks: [
|
|
1267
|
+
{
|
|
1268
|
+
type: "command",
|
|
1269
|
+
command: "bash $HOME/.claude/hooks/keyword-detector.sh"
|
|
1270
|
+
}
|
|
1271
|
+
]
|
|
1272
|
+
}
|
|
1273
|
+
],
|
|
1274
|
+
SessionStart: [
|
|
1275
|
+
{
|
|
1276
|
+
hooks: [
|
|
1277
|
+
{
|
|
1278
|
+
type: "command",
|
|
1279
|
+
command: "bash $HOME/.claude/hooks/session-start.sh"
|
|
1280
|
+
}
|
|
1281
|
+
]
|
|
1282
|
+
}
|
|
1283
|
+
],
|
|
1284
|
+
Stop: [
|
|
1285
|
+
{
|
|
1286
|
+
hooks: [
|
|
1287
|
+
{
|
|
1288
|
+
type: "command",
|
|
1289
|
+
command: "bash $HOME/.claude/hooks/persistent-mode.sh"
|
|
1290
|
+
}
|
|
1291
|
+
]
|
|
1292
|
+
}
|
|
1293
|
+
]
|
|
1294
|
+
}
|
|
1295
|
+
};
|
|
1296
|
+
/**
|
|
1297
|
+
* Settings.json hooks configuration for Node.js (Cross-platform)
|
|
1298
|
+
* Uses node to run .mjs scripts directly
|
|
1299
|
+
*/
|
|
1300
|
+
export const HOOKS_SETTINGS_CONFIG_NODE = {
|
|
1301
|
+
hooks: {
|
|
1302
|
+
UserPromptSubmit: [
|
|
1303
|
+
{
|
|
1304
|
+
hooks: [
|
|
1305
|
+
{
|
|
1306
|
+
type: "command",
|
|
1307
|
+
// Note: On Windows, %USERPROFILE% is expanded by cmd.exe
|
|
1308
|
+
// On Unix with node hooks, $HOME is expanded by the shell
|
|
1309
|
+
command: isWindows()
|
|
1310
|
+
? 'node "%USERPROFILE%\\.claude\\hooks\\keyword-detector.mjs"'
|
|
1311
|
+
: 'node "$HOME/.claude/hooks/keyword-detector.mjs"'
|
|
1312
|
+
}
|
|
1313
|
+
]
|
|
1314
|
+
}
|
|
1315
|
+
],
|
|
1316
|
+
SessionStart: [
|
|
1317
|
+
{
|
|
1318
|
+
hooks: [
|
|
1319
|
+
{
|
|
1320
|
+
type: "command",
|
|
1321
|
+
command: isWindows()
|
|
1322
|
+
? 'node "%USERPROFILE%\\.claude\\hooks\\session-start.mjs"'
|
|
1323
|
+
: 'node "$HOME/.claude/hooks/session-start.mjs"'
|
|
1324
|
+
}
|
|
1325
|
+
]
|
|
1326
|
+
}
|
|
1327
|
+
],
|
|
1328
|
+
Stop: [
|
|
1329
|
+
{
|
|
1330
|
+
hooks: [
|
|
1331
|
+
{
|
|
1332
|
+
type: "command",
|
|
1333
|
+
command: isWindows()
|
|
1334
|
+
? 'node "%USERPROFILE%\\.claude\\hooks\\persistent-mode.mjs"'
|
|
1335
|
+
: 'node "$HOME/.claude/hooks/persistent-mode.mjs"'
|
|
1336
|
+
}
|
|
1337
|
+
]
|
|
1338
|
+
}
|
|
1339
|
+
]
|
|
1340
|
+
}
|
|
1341
|
+
};
|
|
1342
|
+
/**
|
|
1343
|
+
* Get the appropriate hooks settings config for the current platform
|
|
1344
|
+
*/
|
|
1345
|
+
export function getHooksSettingsConfig() {
|
|
1346
|
+
return shouldUseNodeHooks() ? HOOKS_SETTINGS_CONFIG_NODE : HOOKS_SETTINGS_CONFIG_BASH;
|
|
1347
|
+
}
|
|
1348
|
+
/**
|
|
1349
|
+
* Legacy: Settings.json hooks configuration (Bash)
|
|
1350
|
+
* @deprecated Use getHooksSettingsConfig() for cross-platform support
|
|
1351
|
+
*/
|
|
1352
|
+
export const HOOKS_SETTINGS_CONFIG = HOOKS_SETTINGS_CONFIG_BASH;
|
|
1353
|
+
// =============================================================================
|
|
1354
|
+
// HOOK SCRIPTS EXPORTS (Platform-aware)
|
|
1355
|
+
// =============================================================================
|
|
1356
|
+
/**
|
|
1357
|
+
* Bash hook scripts (Unix only)
|
|
1358
|
+
*/
|
|
1359
|
+
export const HOOK_SCRIPTS_BASH = {
|
|
1360
|
+
'keyword-detector.sh': KEYWORD_DETECTOR_SCRIPT,
|
|
1361
|
+
'stop-continuation.sh': STOP_CONTINUATION_SCRIPT,
|
|
1362
|
+
'persistent-mode.sh': PERSISTENT_MODE_SCRIPT,
|
|
1363
|
+
'session-start.sh': SESSION_START_SCRIPT
|
|
1364
|
+
};
|
|
1365
|
+
/**
|
|
1366
|
+
* Node.js hook scripts (Cross-platform)
|
|
1367
|
+
*/
|
|
1368
|
+
export const HOOK_SCRIPTS_NODE = {
|
|
1369
|
+
'keyword-detector.mjs': KEYWORD_DETECTOR_SCRIPT_NODE,
|
|
1370
|
+
'stop-continuation.mjs': STOP_CONTINUATION_SCRIPT_NODE,
|
|
1371
|
+
'persistent-mode.mjs': PERSISTENT_MODE_SCRIPT_NODE,
|
|
1372
|
+
'session-start.mjs': SESSION_START_SCRIPT_NODE
|
|
1373
|
+
};
|
|
1374
|
+
/**
|
|
1375
|
+
* Get the appropriate hook scripts for the current platform
|
|
1376
|
+
*/
|
|
1377
|
+
export function getHookScripts() {
|
|
1378
|
+
return shouldUseNodeHooks() ? HOOK_SCRIPTS_NODE : HOOK_SCRIPTS_BASH;
|
|
1379
|
+
}
|
|
1380
|
+
/**
|
|
1381
|
+
* Legacy: All hook scripts to install (Bash)
|
|
1382
|
+
* @deprecated Use getHookScripts() for cross-platform support
|
|
1383
|
+
*/
|
|
1384
|
+
export const HOOK_SCRIPTS = HOOK_SCRIPTS_BASH;
|
|
1385
|
+
//# sourceMappingURL=hooks.js.map
|