oh-my-opencode 4.8.0 → 4.9.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/dist/agents/prometheus/system-prompt.d.ts +1 -1
- package/dist/agents/sisyphus/claude-fable-5.d.ts +19 -0
- package/dist/agents/sisyphus/claude-opus-4-7.d.ts +3 -1
- package/dist/agents/sisyphus/claude-opus-4-8.d.ts +19 -0
- package/dist/agents/sisyphus/index.d.ts +4 -0
- package/dist/agents/types.d.ts +2 -2
- package/dist/cli/doctor/checks/codex.d.ts +1 -0
- package/dist/cli/doctor/checks/tools-gh.d.ts +8 -1
- package/dist/cli/doctor/index.d.ts +1 -0
- package/dist/cli/doctor/types.d.ts +2 -0
- package/dist/cli/index.js +1922 -785
- package/dist/cli/install-codex/codex-config-permissions.d.ts +1 -1
- package/dist/cli/install-codex/codex-config-plugins.d.ts +1 -0
- package/dist/cli/install-codex/codex-config-toml.d.ts +1 -0
- package/dist/cli/install-codex/codex-installer-bin-dir.d.ts +8 -0
- package/dist/cli/install-codex/codex-multi-agent-v2-config.d.ts +11 -0
- package/dist/cli/install-codex/install-codex.d.ts +1 -8
- package/dist/cli/install-codex/lsp-daemon-reaper.d.ts +5 -0
- package/dist/cli/run/runnable-agent-resolver.d.ts +11 -0
- package/dist/cli/sparkshell-condense.d.ts +10 -0
- package/dist/cli/sparkshell-parse.d.ts +3 -0
- package/dist/cli/sparkshell-session-context.d.ts +20 -0
- package/dist/cli/sparkshell-spark.d.ts +23 -0
- package/dist/cli/sparkshell.d.ts +8 -1
- package/dist/cli-node/index.js +92552 -0
- package/dist/config/schema/agent-names.d.ts +2 -0
- package/dist/config/schema/hooks.d.ts +0 -2
- package/dist/config/schema/keyword-detector.d.ts +0 -6
- package/dist/config/schema/oh-my-opencode-config.d.ts +2 -4
- package/dist/create-hooks.d.ts +0 -2
- package/dist/features/background-agent/parent-wake-dedupe.d.ts +2 -0
- package/dist/features/background-agent/parent-wake-flush-runner.d.ts +2 -0
- package/dist/features/background-agent/parent-wake-prompt-dispatch.d.ts +1 -0
- package/dist/features/background-agent/parent-wake-session-history.d.ts +4 -0
- package/dist/features/background-agent/parent-wake-session-inspector.d.ts +1 -0
- package/dist/features/builtin-commands/templates/handoff.d.ts +1 -1
- package/dist/features/builtin-skills/index.d.ts +1 -1
- package/dist/features/builtin-skills/skills.d.ts +4 -0
- package/dist/features/opencode-runtime-skills/source-server.d.ts +16 -1
- package/dist/features/opencode-skill-loader/skill-definition-record.d.ts +2 -0
- package/dist/features/team-mode/tools/lifecycle-test-fixture.d.ts +2 -0
- package/dist/features/team-mode/types.d.ts +1 -0
- package/dist/features/tmux-subagent/failed-readiness-cache.d.ts +28 -0
- package/dist/features/tmux-subagent/manager.d.ts +1 -9
- package/dist/features/tmux-subagent/resolve-server-url.d.ts +3 -0
- package/dist/hooks/anthropic-context-window-limit-recovery/executor.d.ts +1 -1
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/keyword-detector/constants.d.ts +0 -4
- package/dist/hooks/keyword-detector/ultrawork/source-detector.d.ts +1 -1
- package/dist/index.js +9001 -1795
- package/dist/oh-my-opencode.schema.json +2 -4
- package/dist/plugin/chat-params.d.ts +1 -8
- package/dist/plugin/hooks/create-core-hooks.d.ts +0 -2
- package/dist/plugin/hooks/create-session-hooks.d.ts +0 -2
- package/dist/plugin/hooks/create-transform-hooks.d.ts +1 -2
- package/dist/plugin/messages-transform.d.ts +0 -1
- package/dist/shared/model-availability.d.ts +10 -2
- package/package.json +25 -18
- package/packages/ast-grep-mcp/dist/cli.js +2 -10
- package/packages/git-bash-mcp/dist/cli.js +11 -4
- package/packages/lsp-daemon/dist/cli.d.ts +2 -0
- package/packages/lsp-daemon/dist/cli.js +3711 -0
- package/packages/lsp-daemon/dist/daemon-client.d.ts +19 -0
- package/packages/lsp-daemon/dist/daemon-client.js +114 -0
- package/packages/lsp-daemon/dist/daemon-server.d.ts +12 -0
- package/packages/lsp-daemon/dist/daemon-server.js +106 -0
- package/packages/lsp-daemon/dist/ensure-daemon.d.ts +21 -0
- package/packages/lsp-daemon/dist/ensure-daemon.js +97 -0
- package/packages/lsp-daemon/dist/index.d.ts +5 -0
- package/packages/lsp-daemon/dist/index.js +3573 -0
- package/packages/lsp-daemon/dist/lock.d.ts +7 -0
- package/packages/lsp-daemon/dist/lock.js +61 -0
- package/packages/lsp-daemon/dist/package.json +6 -0
- package/packages/lsp-daemon/dist/paths.d.ts +11 -0
- package/packages/lsp-daemon/dist/paths.js +49 -0
- package/packages/lsp-daemon/dist/proxy.d.ts +10 -0
- package/packages/lsp-daemon/dist/proxy.js +61 -0
- package/packages/lsp-daemon/dist/request-routing.d.ts +9 -0
- package/packages/lsp-daemon/dist/request-routing.js +44 -0
- package/packages/lsp-daemon/dist/run-daemon.d.ts +1 -0
- package/packages/lsp-daemon/dist/run-daemon.js +11 -0
- package/packages/lsp-daemon/dist/socket-jsonrpc.d.ts +5 -0
- package/packages/lsp-daemon/dist/socket-jsonrpc.js +25 -0
- package/packages/lsp-daemon/package.json +38 -0
- package/packages/lsp-tools-mcp/dist/cli.js +0 -0
- package/packages/lsp-tools-mcp/dist/lsp/client-wrapper.js +40 -17
- package/packages/lsp-tools-mcp/dist/lsp/client.js +11 -9
- package/packages/lsp-tools-mcp/dist/lsp/config-loader.js +5 -5
- package/packages/lsp-tools-mcp/dist/lsp/directory-diagnostics.js +5 -3
- package/packages/lsp-tools-mcp/dist/lsp/effective-extension.d.ts +1 -0
- package/packages/lsp-tools-mcp/dist/lsp/effective-extension.js +8 -0
- package/packages/lsp-tools-mcp/dist/lsp/infer-extension.js +3 -2
- package/packages/lsp-tools-mcp/dist/lsp/language-mappings.js +1 -0
- package/packages/lsp-tools-mcp/dist/lsp/server-definitions.js +12 -0
- package/packages/lsp-tools-mcp/dist/lsp/server-install-state.d.ts +12 -0
- package/packages/lsp-tools-mcp/dist/lsp/server-install-state.js +51 -0
- package/packages/lsp-tools-mcp/dist/lsp/workspace-edit.js +2 -1
- package/packages/lsp-tools-mcp/dist/request-context.d.ts +7 -0
- package/packages/lsp-tools-mcp/dist/request-context.js +14 -0
- package/packages/lsp-tools-mcp/dist/tools.js +44 -1
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +46 -33
- package/packages/omo-codex/plugin/.mcp.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/dist/apply-patch.d.ts +7 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/apply-patch.js +173 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/cli.d.ts +2 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/cli.js +10 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/codex-hook.d.ts +22 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/codex-hook.js +165 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/core-values.d.ts +1 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/core-values.js +1 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/core.d.ts +5 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/core.js +4 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/hook-input.d.ts +6 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/hook-input.js +10 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/record.d.ts +2 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/record.js +11 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/request-extractor.d.ts +3 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/request-extractor.js +104 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/runner.d.ts +26 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/runner.js +144 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/types.d.ts +43 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/types.js +1 -0
- package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
- package/packages/omo-codex/plugin/components/git-bash/dist/cli.d.ts +2 -0
- package/packages/omo-codex/plugin/components/git-bash/dist/cli.js +29 -0
- package/packages/omo-codex/plugin/components/git-bash/dist/codex-hook.d.ts +28 -0
- package/packages/omo-codex/plugin/components/git-bash/dist/codex-hook.js +137 -0
- package/packages/omo-codex/plugin/components/git-bash/dist/index.d.ts +1 -0
- package/packages/omo-codex/plugin/components/git-bash/dist/index.js +1 -0
- package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/git-bash/package.json +5 -2
- package/packages/omo-codex/plugin/components/lsp/.mcp.json +1 -1
- package/packages/omo-codex/plugin/components/lsp/dist/cli.d.ts +2 -0
- package/packages/omo-codex/plugin/components/lsp/dist/cli.js +42 -0
- package/packages/omo-codex/plugin/components/lsp/dist/codex-hook-cli.d.ts +2 -0
- package/packages/omo-codex/plugin/components/lsp/dist/codex-hook-cli.js +40 -0
- package/packages/omo-codex/plugin/components/lsp/dist/codex-hook.d.ts +16 -0
- package/packages/omo-codex/plugin/components/lsp/dist/codex-hook.js +180 -0
- package/packages/omo-codex/plugin/components/lsp/dist/lsp-session-state.d.ts +12 -0
- package/packages/omo-codex/plugin/components/lsp/dist/lsp-session-state.js +95 -0
- package/packages/omo-codex/plugin/components/lsp/dist/mutated-file-paths.d.ts +6 -0
- package/packages/omo-codex/plugin/components/lsp/dist/mutated-file-paths.js +79 -0
- package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/package.json +7 -7
- package/packages/omo-codex/plugin/components/lsp/scripts/build-lsp-daemon.mjs +68 -0
- package/packages/omo-codex/plugin/components/lsp/scripts/build-lsp-tools.mjs +45 -22
- package/packages/omo-codex/plugin/components/lsp/src/cli.ts +1 -1
- package/packages/omo-codex/plugin/components/lsp/src/codex-hook-cli.ts +1 -1
- package/packages/omo-codex/plugin/components/lsp/src/codex-hook.ts +6 -2
- package/packages/omo-codex/plugin/components/lsp/src/lsp-session-state.ts +4 -0
- package/packages/omo-codex/plugin/components/lsp/test/codex-hook-unavailable.test.ts +68 -0
- package/packages/omo-codex/plugin/components/lsp/test/package-smoke.test.ts +8 -20
- package/packages/omo-codex/plugin/components/rules/bundled-rules/hephaestus.md +69 -96
- package/packages/omo-codex/plugin/components/rules/dist/cli.d.ts +2 -0
- package/packages/omo-codex/plugin/components/rules/dist/cli.js +118 -0
- package/packages/omo-codex/plugin/components/rules/dist/codex-hook-options.d.ts +5 -0
- package/packages/omo-codex/plugin/components/rules/dist/codex-hook-options.js +1 -0
- package/packages/omo-codex/plugin/components/rules/dist/codex-hook.d.ts +47 -0
- package/packages/omo-codex/plugin/components/rules/dist/codex-hook.js +127 -0
- package/packages/omo-codex/plugin/components/rules/dist/config.d.ts +2 -0
- package/packages/omo-codex/plugin/components/rules/dist/config.js +100 -0
- package/packages/omo-codex/plugin/components/rules/dist/context-pressure.d.ts +2 -0
- package/packages/omo-codex/plugin/components/rules/dist/context-pressure.js +26 -0
- package/packages/omo-codex/plugin/components/rules/dist/debug-log.d.ts +8 -0
- package/packages/omo-codex/plugin/components/rules/dist/debug-log.js +36 -0
- package/packages/omo-codex/plugin/components/rules/dist/dynamic-target-fingerprints.d.ts +7 -0
- package/packages/omo-codex/plugin/components/rules/dist/dynamic-target-fingerprints.js +65 -0
- package/packages/omo-codex/plugin/components/rules/dist/event-budget.d.ts +3 -0
- package/packages/omo-codex/plugin/components/rules/dist/event-budget.js +14 -0
- package/packages/omo-codex/plugin/components/rules/dist/hook-output.d.ts +2 -0
- package/packages/omo-codex/plugin/components/rules/dist/hook-output.js +24 -0
- package/packages/omo-codex/plugin/components/rules/dist/path-utils.d.ts +4 -0
- package/packages/omo-codex/plugin/components/rules/dist/path-utils.js +24 -0
- package/packages/omo-codex/plugin/components/rules/dist/persistent-cache.d.ts +13 -0
- package/packages/omo-codex/plugin/components/rules/dist/persistent-cache.js +172 -0
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-budget.d.ts +6 -0
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-budget.js +74 -0
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-claim.d.ts +4 -0
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-claim.js +6 -0
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-directive.d.ts +1 -0
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-directive.js +32 -0
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-state.d.ts +13 -0
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-state.js +29 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/cache.d.ts +9 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/cache.js +51 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/constants.d.ts +70 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/constants.js +101 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-dynamic-cache.d.ts +5 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-dynamic-cache.js +60 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-dynamic-loader.d.ts +6 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-dynamic-loader.js +61 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-loader.d.ts +7 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-loader.js +60 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-paths.d.ts +11 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-paths.js +75 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-static-loader.d.ts +6 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-static-loader.js +29 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-types.d.ts +44 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-types.js +1 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine.d.ts +5 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine.js +85 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/errors.d.ts +6 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/errors.js +12 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-cache.d.ts +14 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-cache.js +51 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-paths.d.ts +6 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-paths.js +33 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-sources.d.ts +5 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-sources.js +40 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder.d.ts +28 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder.js +146 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/formatter.d.ts +7 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/formatter.js +112 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/matcher.d.ts +18 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/matcher.js +93 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/ordering.d.ts +3 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/ordering.js +27 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser-frontmatter.d.ts +7 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser-frontmatter.js +30 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser-yaml.d.ts +2 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser-yaml.js +237 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser.d.ts +3 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser.js +31 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/plugin-root.d.ts +1 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/plugin-root.js +48 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/project-root.d.ts +1 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/project-root.js +23 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/scanner.d.ts +14 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/scanner.js +111 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/sources.d.ts +3 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/sources.js +9 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/truncator.d.ts +18 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/truncator.js +59 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/types.d.ts +126 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/types.js +8 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules-engine-factory.d.ts +6 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules-engine-factory.js +20 -0
- package/packages/omo-codex/plugin/components/rules/dist/session-state-lock.d.ts +3 -0
- package/packages/omo-codex/plugin/components/rules/dist/session-state-lock.js +41 -0
- package/packages/omo-codex/plugin/components/rules/dist/sparkshell-awareness.d.ts +10 -0
- package/packages/omo-codex/plugin/components/rules/dist/sparkshell-awareness.js +90 -0
- package/packages/omo-codex/plugin/components/rules/dist/static-injection.d.ts +3 -0
- package/packages/omo-codex/plugin/components/rules/dist/static-injection.js +128 -0
- package/packages/omo-codex/plugin/components/rules/dist/tool-paths.d.ts +6 -0
- package/packages/omo-codex/plugin/components/rules/dist/tool-paths.js +168 -0
- package/packages/omo-codex/plugin/components/rules/dist/transcript-rule-filter.d.ts +4 -0
- package/packages/omo-codex/plugin/components/rules/dist/transcript-rule-filter.js +49 -0
- package/packages/omo-codex/plugin/components/rules/dist/transcript-search.d.ts +4 -0
- package/packages/omo-codex/plugin/components/rules/dist/transcript-search.js +91 -0
- package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
- package/packages/omo-codex/plugin/components/rules/package.json +1 -1
- package/packages/omo-codex/plugin/components/rules/src/codex-hook.ts +4 -2
- package/packages/omo-codex/plugin/components/rules/src/config.ts +13 -0
- package/packages/omo-codex/plugin/components/rules/src/event-budget.ts +17 -0
- package/packages/omo-codex/plugin/components/rules/src/persistent-cache.ts +4 -1
- package/packages/omo-codex/plugin/components/rules/src/post-compact-directive.ts +39 -0
- package/packages/omo-codex/plugin/components/rules/src/rules/constants.ts +16 -0
- package/packages/omo-codex/plugin/components/rules/src/rules/engine.ts +8 -0
- package/packages/omo-codex/plugin/components/rules/src/rules/formatter.ts +7 -8
- package/packages/omo-codex/plugin/components/rules/src/rules/truncator.ts +17 -0
- package/packages/omo-codex/plugin/components/rules/src/rules/types.ts +4 -0
- package/packages/omo-codex/plugin/components/rules/src/sparkshell-awareness.ts +53 -4
- package/packages/omo-codex/plugin/components/rules/src/static-injection.ts +127 -7
- package/packages/omo-codex/plugin/components/rules/src/transcript-rule-filter.ts +9 -1
- package/packages/omo-codex/plugin/components/rules/test/bundled-rules.test.ts +4 -2
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-budget.test.ts +7 -2
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-context.test.ts +9 -9
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-dedup.test.ts +10 -4
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-directive.test.ts +241 -0
- package/packages/omo-codex/plugin/components/rules/test/event-budget.test.ts +168 -0
- package/packages/omo-codex/plugin/components/rules/test/formatter.test.ts +20 -0
- package/packages/omo-codex/plugin/components/rules/test/post-compact-budget.test.ts +4 -0
- package/packages/omo-codex/plugin/components/rules/test/sparkshell-awareness.test.ts +86 -3
- package/packages/omo-codex/plugin/components/start-work-continuation/directive.md +15 -15
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/boulder-reader.d.ts +16 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/boulder-reader.js +146 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/cli.d.ts +2 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/cli.js +49 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/codex-hook.d.ts +2 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/codex-hook.js +80 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/directive.d.ts +1 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/directive.js +2 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/index.d.ts +5 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/index.js +3 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/types.d.ts +20 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/types.js +1 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/package.json +1 -1
- package/packages/omo-codex/plugin/components/start-work-continuation/test/codex-hook.test.ts +24 -2
- package/packages/omo-codex/plugin/components/telemetry/dist/atomic-write.d.ts +1 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/atomic-write.js +18 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/cli.d.ts +2 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/cli.js +62 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/codex-hook.d.ts +15 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/codex-hook.js +42 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/data-path.d.ts +10 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/data-path.js +35 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/diagnostics.d.ts +12 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/diagnostics.js +108 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/env-flags.d.ts +4 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/env-flags.js +31 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog-activity-state.d.ts +8 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog-activity-state.js +68 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog.d.ts +21 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog.js +133 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/product-identity.d.ts +8 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/product-identity.js +29 -0
- package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/explorer.toml +5 -13
- package/packages/omo-codex/plugin/components/ultrawork/agents/librarian.toml +61 -185
- package/packages/omo-codex/plugin/components/ultrawork/agents/plan.toml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/directive.md +122 -117
- package/packages/omo-codex/plugin/components/ultrawork/dist/cli.d.ts +2 -0
- package/packages/omo-codex/plugin/components/ultrawork/dist/cli.js +48 -0
- package/packages/omo-codex/plugin/components/ultrawork/dist/codex-hook.d.ts +7 -0
- package/packages/omo-codex/plugin/components/ultrawork/dist/codex-hook.js +122 -0
- package/packages/omo-codex/plugin/components/ultrawork/dist/directive.d.ts +1 -0
- package/packages/omo-codex/plugin/components/ultrawork/dist/directive.js +2 -0
- package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/SKILL.md +20 -11
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/full-workflow.md +17 -11
- package/packages/omo-codex/plugin/components/ultrawork/test/codex-hook.test.ts +2 -5
- package/packages/omo-codex/plugin/components/ultrawork/test/package-smoke.test.ts +0 -71
- package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint.d.ts +16 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint.js +200 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-arg-parser.d.ts +17 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-arg-parser.js +97 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-commands.d.ts +4 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-commands.js +183 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-output.d.ts +6 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-output.js +55 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-steering.d.ts +12 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-steering.js +145 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli.d.ts +2 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli.js +39 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-instruction.d.ts +13 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-instruction.js +100 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-snapshot.d.ts +26 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-snapshot.js +97 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-hook.d.ts +28 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-hook.js +145 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/command-types.d.ts +34 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/command-types.js +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/constants.d.ts +16 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/constants.js +41 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/domain-types.d.ts +95 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/domain-types.js +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/evidence.d.ts +31 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/evidence.js +119 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/goal-status.d.ts +12 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/goal-status.js +69 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/paths.d.ts +16 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/paths.js +59 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-crud.d.ts +48 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-crud.js +119 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-io.d.ts +8 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-io.js +89 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate.d.ts +6 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate.js +123 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/review-blockers.d.ts +16 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/review-blockers.js +70 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/runtime.d.ts +10 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/runtime.js +13 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/steering-types.d.ts +63 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/steering-types.js +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/steering.d.ts +6 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/steering.js +292 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/types.d.ts +5 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/types.js +5 -0
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/SKILL.md +14 -14
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +24 -25
- package/packages/omo-codex/plugin/components/ulw-loop/src/cli-commands.ts +17 -3
- package/packages/omo-codex/plugin/components/ulw-loop/src/cli.ts +2 -1
- package/packages/omo-codex/plugin/components/ulw-loop/src/codex-goal-instruction.ts +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/test/cli-entrypoint.test.ts +95 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/package-smoke.test.ts +0 -96
- package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate.test.ts +23 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/skill-contract.test.ts +46 -0
- package/packages/omo-codex/plugin/hooks/hooks.json +16 -16
- package/packages/omo-codex/plugin/package-lock.json +10 -9
- package/packages/omo-codex/plugin/package.json +27 -26
- package/packages/omo-codex/plugin/scripts/auto-update.mjs +64 -15
- package/packages/omo-codex/plugin/scripts/build-bundled-mcp-runtimes.mjs +16 -0
- package/packages/omo-codex/plugin/scripts/migrate-codex-config/multi-agent-v2-guard.mjs +104 -0
- package/packages/omo-codex/plugin/scripts/migrate-codex-config.mjs +23 -6
- package/packages/omo-codex/plugin/scripts/sync-skills.mjs +23 -11
- package/packages/omo-codex/plugin/scripts/sync-version.mjs +94 -0
- package/packages/omo-codex/plugin/skills/init-deep/SKILL.md +9 -9
- package/packages/omo-codex/plugin/skills/lcx-contribute-bug-fix/SKILL.md +16 -1
- package/packages/omo-codex/plugin/skills/lcx-doctor/SKILL.md +93 -0
- package/packages/omo-codex/plugin/skills/lcx-doctor/agents/openai.yaml +11 -0
- package/packages/omo-codex/plugin/skills/lcx-report-bug/SKILL.md +17 -13
- package/packages/omo-codex/plugin/skills/lsp-setup/SKILL.md +139 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/bash/README.md +60 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/c-cpp/README.md +61 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/csharp/README.md +71 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/dart/README.md +48 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/elixir/README.md +51 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/go/README.md +57 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/haskell/README.md +57 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/java/README.md +57 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/julia/README.md +60 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/kotlin/README.md +59 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/lua/README.md +66 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/php/README.md +62 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/python/README.md +71 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/ruby/README.md +53 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/rust/README.md +59 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/swift/README.md +51 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/terraform/README.md +62 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/typescript/README.md +77 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/yaml/README.md +70 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/zig/README.md +49 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/scripts/detect-lsp.ts +210 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/scripts/lsp-server-table.ts +177 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/scripts/tsconfig.json +17 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/scripts/verify-lsp.ts +147 -0
- package/packages/omo-codex/plugin/skills/refactor/SKILL.md +9 -9
- package/packages/omo-codex/plugin/skills/remove-ai-slops/SKILL.md +10 -10
- package/packages/omo-codex/plugin/skills/review-work/SKILL.md +20 -22
- package/packages/omo-codex/plugin/skills/start-work/SKILL.md +38 -61
- package/packages/omo-codex/plugin/skills/ultraresearch/SKILL.md +135 -677
- package/packages/omo-codex/plugin/skills/ulw-loop/SKILL.md +14 -14
- package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +24 -25
- package/packages/omo-codex/plugin/skills/ulw-plan/SKILL.md +20 -11
- package/packages/omo-codex/plugin/skills/ulw-plan/references/full-workflow.md +17 -11
- package/packages/omo-codex/plugin/skills/visual-qa/SKILL.md +9 -9
- package/packages/omo-codex/plugin/test/aggregate-build.test.mjs +2 -1
- package/packages/omo-codex/plugin/test/aggregate-mcp.test.mjs +1 -1
- package/packages/omo-codex/plugin/test/aggregate-plugin-fixture.mjs +5 -5
- package/packages/omo-codex/plugin/test/aggregate-skills.test.mjs +6 -6
- package/packages/omo-codex/plugin/test/auto-update-restart-notice.test.mjs +194 -0
- package/packages/omo-codex/plugin/test/auto-update.test.mjs +17 -0
- package/packages/omo-codex/plugin/test/lcx-bug-skills.test.mjs +15 -44
- package/packages/omo-codex/plugin/test/lsp-prebuild-layouts.test.mjs +140 -0
- package/packages/omo-codex/plugin/test/migrate-codex-config.test.mjs +261 -0
- package/packages/omo-codex/plugin/test/start-work-skill.test.mjs +9 -31
- package/packages/omo-codex/plugin/test/sync-skills-orchestration.test.mjs +68 -4
- package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +119 -0
- package/packages/omo-codex/plugin/test/sync-skills.test.mjs +11 -112
- package/packages/omo-codex/plugin/test/sync-version.test.mjs +68 -0
- package/packages/omo-codex/plugin/test/ultraresearch-skill-contract.test.mjs +126 -0
- package/packages/omo-codex/plugin/test/ulw-plan-skill.test.mjs +2 -2
- package/packages/omo-codex/scripts/install/bin-dir.mjs +20 -0
- package/packages/omo-codex/scripts/install/bin-links.mjs +43 -6
- package/packages/omo-codex/scripts/install/cache.mjs +4 -0
- package/packages/omo-codex/scripts/install/config.mjs +5 -3
- package/packages/omo-codex/scripts/install/delegated-command.mjs +5 -1
- package/packages/omo-codex/scripts/install/git-bash-mcp-env.mjs +28 -0
- package/packages/omo-codex/scripts/install/git-bash.mjs +12 -4
- package/packages/omo-codex/scripts/install/git-bash.test.mjs +39 -4
- package/packages/omo-codex/scripts/install/hook-targets.mjs +46 -0
- package/packages/omo-codex/scripts/install/multi-agent-v2-config.mjs +22 -10
- package/packages/omo-codex/scripts/install/process.mjs +1 -0
- package/packages/omo-codex/scripts/install-bin-links.test.mjs +131 -3
- package/packages/omo-codex/scripts/install-config-git-bash.test.mjs +91 -0
- package/packages/omo-codex/scripts/install-config.test.mjs +50 -44
- package/packages/omo-codex/scripts/install-delegated-command.test.mjs +78 -0
- package/packages/omo-codex/scripts/install-git-bash-mcp-env.test.mjs +93 -0
- package/packages/omo-codex/scripts/install-hook-targets.test.mjs +100 -0
- package/packages/omo-codex/scripts/install-lazycodex-version-stamp.test.mjs +3 -1
- package/packages/omo-codex/scripts/install-local.mjs +7 -18
- package/packages/omo-codex/scripts/install-local.test.mjs +34 -1
- package/packages/shared-skills/skills/lcx-contribute-bug-fix/SKILL.md +16 -1
- package/packages/shared-skills/skills/lcx-doctor/SKILL.md +93 -0
- package/packages/shared-skills/skills/lcx-doctor/agents/openai.yaml +11 -0
- package/packages/shared-skills/skills/lcx-report-bug/SKILL.md +17 -13
- package/packages/shared-skills/skills/lsp-setup/SKILL.md +139 -0
- package/packages/shared-skills/skills/lsp-setup/references/bash/README.md +60 -0
- package/packages/shared-skills/skills/lsp-setup/references/c-cpp/README.md +61 -0
- package/packages/shared-skills/skills/lsp-setup/references/csharp/README.md +71 -0
- package/packages/shared-skills/skills/lsp-setup/references/dart/README.md +48 -0
- package/packages/shared-skills/skills/lsp-setup/references/elixir/README.md +51 -0
- package/packages/shared-skills/skills/lsp-setup/references/go/README.md +57 -0
- package/packages/shared-skills/skills/lsp-setup/references/haskell/README.md +57 -0
- package/packages/shared-skills/skills/lsp-setup/references/java/README.md +57 -0
- package/packages/shared-skills/skills/lsp-setup/references/julia/README.md +60 -0
- package/packages/shared-skills/skills/lsp-setup/references/kotlin/README.md +59 -0
- package/packages/shared-skills/skills/lsp-setup/references/lua/README.md +66 -0
- package/packages/shared-skills/skills/lsp-setup/references/php/README.md +62 -0
- package/packages/shared-skills/skills/lsp-setup/references/python/README.md +71 -0
- package/packages/shared-skills/skills/lsp-setup/references/ruby/README.md +53 -0
- package/packages/shared-skills/skills/lsp-setup/references/rust/README.md +59 -0
- package/packages/shared-skills/skills/lsp-setup/references/swift/README.md +51 -0
- package/packages/shared-skills/skills/lsp-setup/references/terraform/README.md +62 -0
- package/packages/shared-skills/skills/lsp-setup/references/typescript/README.md +77 -0
- package/packages/shared-skills/skills/lsp-setup/references/yaml/README.md +70 -0
- package/packages/shared-skills/skills/lsp-setup/references/zig/README.md +49 -0
- package/packages/shared-skills/skills/lsp-setup/scripts/detect-lsp.ts +210 -0
- package/packages/shared-skills/skills/lsp-setup/scripts/lsp-server-table.ts +177 -0
- package/packages/shared-skills/skills/lsp-setup/scripts/tsconfig.json +17 -0
- package/packages/shared-skills/skills/lsp-setup/scripts/verify-lsp.ts +147 -0
- package/packages/shared-skills/skills/remove-ai-slops/SKILL.md +1 -1
- package/packages/shared-skills/skills/review-work/SKILL.md +10 -14
- package/packages/shared-skills/skills/start-work/SKILL.md +30 -59
- package/packages/shared-skills/skills/ultraresearch/SKILL.md +126 -667
- package/dist/hooks/anthropic-effort/hook.d.ts +0 -26
- package/dist/hooks/anthropic-effort/index.d.ts +0 -1
- package/dist/hooks/keyword-detector/analyze/default.d.ts +0 -12
- package/dist/hooks/keyword-detector/analyze/index.d.ts +0 -1
- package/dist/hooks/keyword-detector/search/default.d.ts +0 -12
- package/dist/hooks/keyword-detector/search/index.d.ts +0 -1
- package/dist/hooks/thinking-block-validator/hook.d.ts +0 -12
- package/dist/hooks/thinking-block-validator/index.d.ts +0 -1
- package/packages/omo-codex/plugin/components/ultrawork/test/directive-contract.test.ts +0 -18
- package/packages/omo-codex/plugin/test/global-review-debug-gate.test.mjs +0 -29
- package/packages/omo-codex/plugin/test/subagent-guidance.test.mjs +0 -151
|
@@ -11,142 +11,126 @@ Warm but spare. Communicate efficiently - enough context for the user to trust t
|
|
|
11
11
|
|
|
12
12
|
# Autonomy and Persistence
|
|
13
13
|
|
|
14
|
-
User instructions override these defaults
|
|
14
|
+
User instructions override these defaults; newer instructions override older. Safety and type-safety constraints never yield.
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
**Implement, don't propose.** Unless the user is asking a question, brainstorming, or explicitly requesting a plan, they want code and tools, not a description of one.
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
Examine the codebase before changing it, dig past the surface answer, and persist until the work is done. Resolve blockers yourself; move forward on context and reasonable assumptions (see Asking the user, below).
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
If the user's plan or design seems flawed, say so concisely, propose the alternative, and ask whether to proceed with the original or the alternative - never silently override. Mention high-impact bugs or misconceptions you spot along the way briefly; broaden the task only when it blocks the requested outcome or the user asks.
|
|
21
21
|
|
|
22
|
-
Status requests are not stop signals
|
|
22
|
+
Status requests are not stop signals: give the update, keep working. The newest non-conflicting message wins; honor every non-conflicting request since your last turn. After compaction, continue from the summary; don't restart.
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
Unexpected worktree changes you did not make: keep working - the user or other agents may be working concurrently. Never revert, undo, or modify them unless explicitly asked. Work around unrelated ones touching your files; if a direct conflict with your task is unresolvable, ask one precise question.
|
|
25
25
|
|
|
26
26
|
# Goal
|
|
27
27
|
|
|
28
|
-
Resolve the user's task end-to-end in this turn. The goal is not a green build; it is an artifact
|
|
28
|
+
Resolve the user's task end-to-end in this turn. The goal is not a green build; it is an artifact **driven through its matching surface** and observed working (Manual QA Gate). Clean LSP diagnostics, green build, passing tests are evidence on the way to that gate, not the gate itself. The user's spec is the spec; "done" means the spec is satisfied in observable behavior.
|
|
29
29
|
|
|
30
30
|
# Intent
|
|
31
31
|
|
|
32
|
-
Users chose you for action, not analysis. Your priors may
|
|
32
|
+
Users chose you for action, not analysis. Your priors may read messages too literally - extract true intent first. **Implement, don't propose**: a message implies action unless it explicitly says otherwise.
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
| "Why is A broken?" / "Seeing error B" | Fix A or B | Diagnose, then fix |
|
|
41
|
-
| "What do you think about C?" | Evaluate and implement | Evaluate, then act |
|
|
34
|
+
- "Did you do X?" (and you didn't) -> acknowledge briefly, do X now
|
|
35
|
+
- "How does X work?" -> understand, then fix or improve
|
|
36
|
+
- "Can you look into Y?" -> investigate, then resolve
|
|
37
|
+
- "What's the best way to do Z?" -> decide, then implement the best way
|
|
38
|
+
- "Why is A broken?" / "Seeing error B" -> diagnose, then fix
|
|
39
|
+
- "What do you think about C?" -> evaluate, then act
|
|
42
40
|
|
|
43
|
-
**Pure question (no action) only when ALL hold**:
|
|
41
|
+
**Pure question (no action) only when ALL hold**: an explicit "just explain" / "don't change anything" / "I'm just curious"; no actionable codebase context; no problem or improvement implied.
|
|
44
42
|
|
|
45
|
-
State your read in one line before acting: "I detect [intent type] - [reason]. [What I'm doing now]."
|
|
43
|
+
State your read in one line before acting: "I detect [intent type] - [reason]. [What I'm doing now]." Naming an implementation, fix, or investigation **commits you to finish it in the same turn** - that line is a commitment, not a label.
|
|
46
44
|
|
|
47
45
|
# Discovery & Retrieval
|
|
48
46
|
|
|
49
|
-
Never speculate about code you have not read. The worktree is shared with the user and other agents
|
|
47
|
+
Never speculate about code you have not read. The worktree is shared with the user and other agents: verify with tools, not internal reasoning, and re-read on every task hand-off, even when the request feels familiar.
|
|
50
48
|
|
|
51
49
|
Exploration is cheap; assumption is expensive. Over-exploration is also failure.
|
|
52
50
|
|
|
53
|
-
**Start broad once.** For non-trivial work, run independent file reads, `rg` searches, symbol lookups, and
|
|
51
|
+
**Start broad once.** For non-trivial work, run independent file reads, `rg` searches, symbol lookups, and doc retrieval in parallel - a complete mental model before the first edit.
|
|
54
52
|
|
|
55
|
-
**
|
|
56
|
-
- The first batch did not answer the core question.
|
|
57
|
-
- A required fact, file path, type, owner, or convention is still missing.
|
|
58
|
-
- A second-order question (callers, error paths, ownership, side effects) surfaced that changes the design.
|
|
59
|
-
- A specific document, source, or commit must be read to commit to a decision.
|
|
53
|
+
**Retrieve again only when** the first batch missed the core question; a required fact, path, type, owner, or convention is still missing; a second-order question (callers, error paths, ownership, side effects) changes the design; or a specific document, source, or commit must be read to commit to a decision.
|
|
60
54
|
|
|
61
|
-
**Don't stop at the surface.**
|
|
55
|
+
**Don't stop at the surface.** Unsure whether to call a tool? Call it. Think you understand? Check one more layer of dependencies or callers - a finding too simple for the question's complexity probably is. Prefer the root fix over the symptom fix unless the time budget forces otherwise. Resolve prerequisite lookups before any action depending on them.
|
|
62
56
|
|
|
63
|
-
**
|
|
64
|
-
|
|
65
|
-
**Stop searching when** you have enough context to act, the same information repeats across sources, or two rounds yielded no new useful data.
|
|
57
|
+
**Stop searching when** you have enough context to act, sources repeat, or two rounds yielded no new useful data.
|
|
66
58
|
|
|
67
59
|
# Parallelize aggressively
|
|
68
60
|
|
|
69
|
-
**Independent tool calls run in the same response, never sequentially.** This is the dominant lever on speed and accuracy
|
|
61
|
+
**Independent tool calls run in the same response, never sequentially.** This is the dominant lever on speed and accuracy; serial is the exception and requires a real dependency. Each independent shell command is its own tool call - never chain unrelated steps with `;` or `&&`.
|
|
70
62
|
|
|
71
|
-
-
|
|
72
|
-
- omo-codex auto-runs LSP diagnostics after every edit and injects the result. Treat any reported error as blocking until resolved; you may also invoke diagnostics explicitly.
|
|
63
|
+
omo-codex auto-runs LSP diagnostics after every edit and injects the result: any reported error is blocking until resolved. You may also invoke diagnostics explicitly.
|
|
73
64
|
|
|
74
65
|
# Subagents
|
|
75
66
|
|
|
76
|
-
omo-codex bundles
|
|
77
|
-
|
|
78
|
-
**Default to parallel `spawn_agent` over self-research.** When you need 2+ independent investigations (different modules, different external libraries, different angles on the same question), fire them in parallel via `multi_tool_use.parallel` instead of running searches yourself. Subagents are async from your perspective: dispatch the batch, do non-overlapping prep, integrate results when they return.
|
|
67
|
+
omo-codex bundles read-only Codex subagent roles in `CODEX_HOME/agents/`. Spawn: `multi_agent_v1.spawn_agent({"message":"TASK: act as a <role>. ...","fork_context":false})`
|
|
79
68
|
|
|
80
|
-
|
|
69
|
+
- `explorer` - codebase search: "Where is X?" / "Find code that does Y"
|
|
70
|
+
- `librarian` - external docs, OSS code, API contracts (gh CLI + web)
|
|
71
|
+
- `plan` - strategic planning: 5+ interdependent steps, ambiguous scope, multi-module work
|
|
72
|
+
- `codex-ultrawork-reviewer` - rigorous verification of a finished change
|
|
81
73
|
|
|
82
|
-
-
|
|
83
|
-
- "How does library Z work?" / "What's the API contract?" -> `spawn_agent({"task_name":"...","message":"TASK: act as a librarian. ...","fork_turns":"none"})`
|
|
84
|
-
- 5+ interdependent steps, ambiguous scope, multi-module work -> `spawn_agent({"task_name":"...","message":"TASK: act as a planning agent. ...","fork_turns":"none"})`
|
|
85
|
-
- Heavy verification of a finished change -> `spawn_agent({"task_name":"...","message":"TASK: act as a rigorous reviewer. ...","fork_turns":"none"})`
|
|
74
|
+
**Default to parallel spawns over self-research.** For 2+ independent investigations (different modules, libraries, or angles), fire them in parallel instead of searching yourself. Subagents are async: dispatch the batch, do non-overlapping prep, integrate results on return.
|
|
86
75
|
|
|
87
|
-
**Don't duplicate.** Once a subagent is
|
|
76
|
+
**Don't duplicate.** Once a search or subagent is running on a question - through any tool or external process - do not search it yourself: do non-overlapping prep, or wait. Never poll running work without a completion signal. When results return, integrate; do not repeat their tool calls to re-verify.
|
|
88
77
|
|
|
89
|
-
**Keep parent liveness visible.** While
|
|
78
|
+
**Keep parent liveness visible.** While children run - especially long `multi_agent_v1.wait_agent` cycles - post brief status updates (active subagent count, agent names, latest `WORKING:` phase, mailbox-wait state) so the session never looks idle.
|
|
90
79
|
|
|
91
80
|
# Operating Loop
|
|
92
81
|
|
|
93
|
-
**Explore -> Plan -> Implement -> Verify -> Manually QA.** Loops are short and tight;
|
|
82
|
+
**Explore -> Plan -> Implement -> Verify -> Manually QA.** Loops are short and tight; never loop back with a draft when the work is yours to do.
|
|
94
83
|
|
|
95
|
-
- **Explore
|
|
96
|
-
- **Plan
|
|
97
|
-
- **Implement
|
|
98
|
-
- **Verify
|
|
99
|
-
- **Manually QA
|
|
84
|
+
- **Explore** per Discovery & Retrieval.
|
|
85
|
+
- **Plan** via `update_plan` per Task Tracking: files to modify, specific changes, dependencies.
|
|
86
|
+
- **Implement** surgically per Pragmatism & Scope, matching codebase style - naming, indentation, imports, error handling - even when you would write it differently in a greenfield.
|
|
87
|
+
- **Verify**: LSP diagnostics on changed files, related tests, build if applicable - in parallel where possible.
|
|
88
|
+
- **Manually QA**: drive the artifact through its matching surface (Manual QA Gate), then write the final message.
|
|
100
89
|
|
|
101
90
|
# Manual QA Gate
|
|
102
91
|
|
|
103
|
-
LSP diagnostics catch type errors, not logic bugs; tests cover only what their authors anticipated. **"Done" requires
|
|
92
|
+
LSP diagnostics catch type errors, not logic bugs; tests cover only what their authors anticipated. **"Done" requires the artifact has been driven through its matching surface - you personally used the deliverable and observed it working - within this turn.** The surface picks the tool:
|
|
104
93
|
|
|
105
|
-
- **TUI / CLI / shell binary** - launch through Codex shell
|
|
106
|
-
- **Web / browser-rendered UI** - drive a real browser via an MCP browser tool if available
|
|
94
|
+
- **TUI / CLI / shell binary** - launch through Codex shell: send input, run the happy path, try one bad input, hit `--help`, read the rendered output.
|
|
95
|
+
- **Web / browser-rendered UI** - drive a real browser via an MCP browser tool if available: open the page, click the elements, fill the forms, watch the console, screenshot when it helps.
|
|
107
96
|
- **HTTP API / running service** - hit the live process with `curl` or a driver script.
|
|
108
|
-
- **Library / SDK / module** -
|
|
109
|
-
- **No matching surface** -
|
|
97
|
+
- **Library / SDK / module** - a minimal driver script that imports and executes the new code end-to-end.
|
|
98
|
+
- **No matching surface** - how would a real user discover this works? Do exactly that.
|
|
110
99
|
|
|
111
|
-
Reading the source and concluding "this should work" does not pass this gate.
|
|
100
|
+
Reading the source and concluding "this should work" does not pass this gate. A defect found in usage is yours to fix in this turn - same turn, not "follow-up".
|
|
112
101
|
|
|
113
102
|
# Global Review and Debugging Gate
|
|
114
103
|
|
|
115
|
-
For significant implementation work and every PR handoff, run `review-work` plus a `debugging` runtime audit before declaring completion. Timeout, missing deliverable, ack-only, `BLOCKED:`, and inconclusive review lanes fail the gate. Record at least three debugging hypotheses
|
|
104
|
+
For significant implementation work and every PR handoff, run `review-work` plus a `debugging` runtime audit before declaring completion. Timeout, missing deliverable, ack-only, `BLOCKED:`, and inconclusive review lanes fail the gate. Record at least three debugging hypotheses with the runtime evidence confirming or refuting each.
|
|
116
105
|
|
|
117
|
-
|
|
106
|
+
No completion message, PR, or PR/branch handoff until the gate passes. Always redact secrets, tokens, credentials, auth headers, cookies, env dumps, private logs, and PII from ledgers, PR bodies, and handoffs.
|
|
118
107
|
|
|
119
108
|
# Failure Recovery
|
|
120
109
|
|
|
121
110
|
If your first approach fails, try a materially different one - different algorithm, library, or pattern, not a small tweak. Verify after every attempt; stale state is the most common cause of confusing failures.
|
|
122
111
|
|
|
123
|
-
**Three-attempt
|
|
124
|
-
|
|
125
|
-
1. Stop editing immediately.
|
|
126
|
-
2. Revert only your own changes to a known-good state, or undo your own edits surgically.
|
|
127
|
-
3. Document each attempt and why it failed.
|
|
128
|
-
4. Step back, document failure context in detail, then ask the user one precise question.
|
|
112
|
+
**Three-attempt protocol.** After three different approaches fail: stop editing immediately; revert or surgically undo only your own changes back to a known-good state; document each attempt and why it failed; then step back and ask the user one precise question carrying that failure context.
|
|
129
113
|
|
|
130
114
|
# Pragmatism & Scope
|
|
131
115
|
|
|
132
116
|
The best change is often the smallest correct change. When two approaches both work, prefer the one with fewer new names, helpers, layers, and tests.
|
|
133
117
|
|
|
134
|
-
- Keep obvious single-use logic inline
|
|
135
|
-
- A small amount of duplication
|
|
136
|
-
- Bug fix != surrounding cleanup. Simple feature != extra configurability.
|
|
137
|
-
- Fix only issues your changes caused
|
|
118
|
+
- Keep obvious single-use logic inline; extract a helper only when it is reused, hides meaningful complexity, or names a real domain concept.
|
|
119
|
+
- A small amount of duplication beats speculative abstraction.
|
|
120
|
+
- Bug fix != surrounding cleanup - do not refactor surrounding code while fixing. Simple feature != extra configurability.
|
|
121
|
+
- Fix only issues your changes caused; pre-existing lint errors or failing tests unrelated to your work go in the final message as observations, not in the diff.
|
|
138
122
|
|
|
139
123
|
## No defensive code, no speculative legacy
|
|
140
124
|
|
|
141
|
-
|
|
125
|
+
Write only what the current correct path needs: no error handlers, fallbacks, retries, or input validation for scenarios the current contracts make impossible. Trust framework guarantees and internal types; validate only at system boundaries - user input, external APIs, untrusted I/O.
|
|
142
126
|
|
|
143
|
-
|
|
127
|
+
No backward-compatibility code, migration shims, or alternate code paths "in case". Preserve old formats only when they exist outside the current implementation cycle: persisted data, shipped behavior, external consumers, or an explicit user requirement. Earlier unreleased shapes within the current cycle are drafts, not contracts.
|
|
144
128
|
|
|
145
|
-
Default to
|
|
129
|
+
Default to no new tests. Add one only when the user asks, the change fixes a subtle bug, or it protects an important behavioral boundary existing tests miss. Never add tests to a codebase with no tests. Never make a test pass at the expense of correctness.
|
|
146
130
|
|
|
147
131
|
# Code review requests
|
|
148
132
|
|
|
149
|
-
When the user asks for a "review",
|
|
133
|
+
When the user asks for a "review", findings come first, ordered by severity with file references; open questions and assumptions follow; the change-summary is secondary, not the lead. No findings? Say so explicitly and call out residual risks and testing gaps.
|
|
150
134
|
|
|
151
135
|
# AGENTS.md
|
|
152
136
|
|
|
@@ -154,11 +138,11 @@ AGENTS.md files in your context carry directory-scoped conventions. Obey them fo
|
|
|
154
138
|
|
|
155
139
|
# Output
|
|
156
140
|
|
|
157
|
-
**Preamble.** Before the first tool call on any multi-step task, send
|
|
141
|
+
**Preamble.** Before the first tool call on any multi-step task, send a 1-2 sentence user-visible update: acknowledge the request, state your first concrete step.
|
|
158
142
|
|
|
159
|
-
**During work.**
|
|
143
|
+
**During work.** One sentence at meaningful phase transitions only - a discovery that changes the plan, a decision with tradeoffs, a blocker, the start of a non-trivial verification step. Never narrate routine reads or `rg` calls.
|
|
160
144
|
|
|
161
|
-
**Final message.** Lead with the result, then
|
|
145
|
+
**Final message.** Lead with the result, then supporting context for where and why. No conversational openers ("Done -", "Got it"). Group by user-facing outcome, not by file. Simple work: 1-2 short paragraphs; larger work: at most 2-4 short sections.
|
|
162
146
|
|
|
163
147
|
**Formatting.**
|
|
164
148
|
|
|
@@ -168,26 +152,19 @@ AGENTS.md files in your context carry directory-scoped conventions. Obey them fo
|
|
|
168
152
|
- No emojis or em dashes unless the user explicitly requests them.
|
|
169
153
|
- Never output broken inline citations like `【F:README.md†L5-L14】` - they break the CLI.
|
|
170
154
|
|
|
171
|
-
# Success Criteria
|
|
155
|
+
# Success Criteria and Stop Rules
|
|
172
156
|
|
|
173
157
|
Done when ALL of:
|
|
174
158
|
|
|
175
|
-
- Every behavior the user asked for is implemented
|
|
159
|
+
- Every behavior the user asked for is implemented - no partial delivery, no "v0 / extend later".
|
|
176
160
|
- LSP diagnostics clean on every file you changed.
|
|
177
161
|
- Build (if applicable) exits 0; tests pass, or pre-existing failures are explicitly named with the reason.
|
|
178
|
-
- The artifact has been driven through its matching surface in this turn (Manual QA Gate).
|
|
162
|
+
- The artifact has been **driven through its matching surface** in this turn (Manual QA Gate).
|
|
179
163
|
- The final message reports what you did, what you verified, what you could not verify (with the reason), and any pre-existing issues you noticed but did not touch.
|
|
180
164
|
|
|
181
|
-
When you think you are done: re-read the original request and your intent line
|
|
182
|
-
|
|
183
|
-
# Stop Rules
|
|
165
|
+
When you think you are done: re-read the original request and your intent line - did every committed action complete? Run verification once more on changed files in parallel, then report.
|
|
184
166
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
**Forbidden stops:**
|
|
188
|
-
|
|
189
|
-
- Stopping when Success Criteria are not all true (especially Manual QA Gate).
|
|
190
|
-
- Stopping after a tool reports success, without verifying the changed files and observable behavior.
|
|
167
|
+
Stop **only when** all of the above are true. Until then, **keep going** - through failed tool calls, long turns, and the temptation to hand back a draft. Forbidden stops: the artifact not yet driven through its matching surface; a tool reported success but you have not verified the changed files and observable behavior.
|
|
191
168
|
|
|
192
169
|
**Hard invariants** - non-negotiable, regardless of pressure to ship:
|
|
193
170
|
|
|
@@ -198,20 +175,16 @@ Write the final message and stop **only when** Success Criteria are all true. Un
|
|
|
198
175
|
- Never revert changes you did not make unless explicitly asked.
|
|
199
176
|
- Never invent fake citations, fake tool output, or fake verification results.
|
|
200
177
|
|
|
201
|
-
**Asking the user** is a last resort
|
|
178
|
+
**Asking the user** is a last resort: a missing secret, a design decision only they can make, a destructive action you should not take unilaterally, or missing information that would materially change the answer or create real risk. Even then, ask exactly one precise, narrow question and stop. Never ask permission to do obvious work.
|
|
202
179
|
|
|
203
180
|
# Task Tracking
|
|
204
181
|
|
|
205
|
-
`update_plan`
|
|
182
|
+
Use `update_plan` for anything beyond a single atomic edit: 2+ steps, uncertain scope, multi-file changes, branching investigation. Skip planning only for the easiest 25%; never make single-step plans. **Improvising past step 2 without a plan? Stop and call `update_plan` now.**
|
|
206
183
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
- Atomic steps, one verifiable outcome each. Name the deliverable ("edit `foo.ts` to add X"), not the verb ("work on foo").
|
|
210
|
-
- Exactly ONE step `in_progress` at a time. Never zero, never two.
|
|
184
|
+
- Atomic steps, one verifiable outcome each: name the deliverable ("edit `foo.ts` to add X"), not the verb ("work on foo").
|
|
185
|
+
- Exactly ONE step `in_progress` at a time - never zero, never two.
|
|
211
186
|
- Mark `completed` the instant the outcome lands. NEVER batch.
|
|
212
|
-
- When discovery shifts the plan, update it in the SAME response
|
|
213
|
-
- Before ending the turn, reconcile EVERY step: `completed`, blocked (one-line reason), or removed (one-line reason). No `in_progress` or `pending` items at end of turn
|
|
214
|
-
|
|
215
|
-
**Promise discipline.** Do not commit to tests, broad refactors, or follow-up work in `update_plan` unless you will do them now. Anything you will not finish belongs in the final-message "next steps", not in the plan.
|
|
187
|
+
- When discovery shifts the plan, update it in the SAME response - no silent drift.
|
|
188
|
+
- Before ending the turn, reconcile EVERY step: `completed`, blocked (one-line reason), or removed (one-line reason). **No `in_progress` or `pending` items at end of turn.**
|
|
216
189
|
|
|
217
|
-
**
|
|
190
|
+
**Promise discipline.** Commit to tests, broad refactors, or follow-up work in `update_plan` only if you will do them now; anything you will not finish belongs in the final-message "next steps", not in the plan.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { stdin as processStdin, stdout as processStdout } from "node:process";
|
|
3
|
+
import { runPostCompactHook, runPostToolUseHook, runSessionStartHook, runUserPromptSubmitHook, } from "./codex-hook.js";
|
|
4
|
+
const command = process.argv[2];
|
|
5
|
+
const subcommand = process.argv[3];
|
|
6
|
+
if (command === "hook" && subcommand === "session-start") {
|
|
7
|
+
await runHookCli("SessionStart");
|
|
8
|
+
}
|
|
9
|
+
else if (command === "hook" && subcommand === "user-prompt-submit") {
|
|
10
|
+
await runHookCli("UserPromptSubmit");
|
|
11
|
+
}
|
|
12
|
+
else if (command === "hook" && subcommand === "post-tool-use") {
|
|
13
|
+
await runHookCli("PostToolUse");
|
|
14
|
+
}
|
|
15
|
+
else if (command === "hook" && subcommand === "post-compact") {
|
|
16
|
+
await runHookCli("PostCompact");
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
process.stderr.write("Usage: omo-rules hook [session-start|user-prompt-submit|post-tool-use|post-compact]\n");
|
|
20
|
+
process.exitCode = 1;
|
|
21
|
+
}
|
|
22
|
+
async function runHookCli(eventName) {
|
|
23
|
+
const raw = await readStdin();
|
|
24
|
+
if (raw.trim().length === 0)
|
|
25
|
+
return;
|
|
26
|
+
const parsed = parseHookInput(raw);
|
|
27
|
+
if (!parsed)
|
|
28
|
+
return;
|
|
29
|
+
const pluginDataRoot = process.env["PLUGIN_DATA"];
|
|
30
|
+
const options = pluginDataRoot === undefined ? {} : { pluginDataRoot };
|
|
31
|
+
const output = await runHook(eventName, parsed, options);
|
|
32
|
+
if (output.length > 0) {
|
|
33
|
+
processStdout.write(output);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async function runHook(eventName, parsed, options) {
|
|
37
|
+
switch (eventName) {
|
|
38
|
+
case "SessionStart":
|
|
39
|
+
return isCodexSessionStartInput(parsed) ? await runSessionStartHook(parsed, options) : "";
|
|
40
|
+
case "UserPromptSubmit":
|
|
41
|
+
return isCodexUserPromptSubmitInput(parsed) ? await runUserPromptSubmitHook(parsed, options) : "";
|
|
42
|
+
case "PostToolUse":
|
|
43
|
+
return isCodexPostToolUseInput(parsed) ? await runPostToolUseHook(parsed, options) : "";
|
|
44
|
+
case "PostCompact":
|
|
45
|
+
return isCodexPostCompactInput(parsed) ? await runPostCompactHook(parsed, options) : "";
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function parseHookInput(raw) {
|
|
49
|
+
try {
|
|
50
|
+
const parsed = JSON.parse(raw);
|
|
51
|
+
return parsed;
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function isCodexSessionStartInput(value) {
|
|
58
|
+
return (isRecord(value) &&
|
|
59
|
+
value["hook_event_name"] === "SessionStart" &&
|
|
60
|
+
typeof value["session_id"] === "string" &&
|
|
61
|
+
isStringOrNull(value["transcript_path"]) &&
|
|
62
|
+
typeof value["cwd"] === "string" &&
|
|
63
|
+
typeof value["model"] === "string" &&
|
|
64
|
+
typeof value["permission_mode"] === "string" &&
|
|
65
|
+
typeof value["source"] === "string");
|
|
66
|
+
}
|
|
67
|
+
function isCodexUserPromptSubmitInput(value) {
|
|
68
|
+
return (isRecord(value) &&
|
|
69
|
+
value["hook_event_name"] === "UserPromptSubmit" &&
|
|
70
|
+
typeof value["session_id"] === "string" &&
|
|
71
|
+
typeof value["turn_id"] === "string" &&
|
|
72
|
+
isStringOrNull(value["transcript_path"]) &&
|
|
73
|
+
typeof value["cwd"] === "string" &&
|
|
74
|
+
typeof value["model"] === "string" &&
|
|
75
|
+
typeof value["permission_mode"] === "string" &&
|
|
76
|
+
typeof value["prompt"] === "string");
|
|
77
|
+
}
|
|
78
|
+
function isCodexPostToolUseInput(value) {
|
|
79
|
+
return (isRecord(value) &&
|
|
80
|
+
value["hook_event_name"] === "PostToolUse" &&
|
|
81
|
+
typeof value["session_id"] === "string" &&
|
|
82
|
+
typeof value["turn_id"] === "string" &&
|
|
83
|
+
isStringOrNull(value["transcript_path"]) &&
|
|
84
|
+
typeof value["cwd"] === "string" &&
|
|
85
|
+
typeof value["model"] === "string" &&
|
|
86
|
+
typeof value["permission_mode"] === "string" &&
|
|
87
|
+
typeof value["tool_name"] === "string" &&
|
|
88
|
+
typeof value["tool_use_id"] === "string");
|
|
89
|
+
}
|
|
90
|
+
function isCodexPostCompactInput(value) {
|
|
91
|
+
return (isRecord(value) &&
|
|
92
|
+
value["hook_event_name"] === "PostCompact" &&
|
|
93
|
+
typeof value["session_id"] === "string" &&
|
|
94
|
+
typeof value["turn_id"] === "string" &&
|
|
95
|
+
isStringOrNull(value["transcript_path"]) &&
|
|
96
|
+
typeof value["cwd"] === "string" &&
|
|
97
|
+
typeof value["model"] === "string" &&
|
|
98
|
+
(value["trigger"] === "manual" || value["trigger"] === "auto"));
|
|
99
|
+
}
|
|
100
|
+
function isStringOrNull(value) {
|
|
101
|
+
return typeof value === "string" || value === null;
|
|
102
|
+
}
|
|
103
|
+
function isRecord(value) {
|
|
104
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
105
|
+
}
|
|
106
|
+
function readStdin() {
|
|
107
|
+
return new Promise((resolve, reject) => {
|
|
108
|
+
let data = "";
|
|
109
|
+
processStdin.setEncoding("utf8");
|
|
110
|
+
processStdin.on("data", (chunk) => {
|
|
111
|
+
data += chunk;
|
|
112
|
+
});
|
|
113
|
+
processStdin.once("error", reject);
|
|
114
|
+
processStdin.once("end", () => {
|
|
115
|
+
resolve(data);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { CodexRulesHookOptions } from "./codex-hook-options.js";
|
|
2
|
+
export type { CodexRulesHookOptions } from "./codex-hook-options.js";
|
|
3
|
+
export type CodexSessionStartInput = {
|
|
4
|
+
session_id: string;
|
|
5
|
+
transcript_path: string | null;
|
|
6
|
+
cwd: string;
|
|
7
|
+
hook_event_name: "SessionStart";
|
|
8
|
+
model: string;
|
|
9
|
+
permission_mode: string;
|
|
10
|
+
source: "startup" | "resume" | "clear" | "compact";
|
|
11
|
+
};
|
|
12
|
+
export type CodexUserPromptSubmitInput = {
|
|
13
|
+
session_id: string;
|
|
14
|
+
turn_id: string;
|
|
15
|
+
transcript_path: string | null;
|
|
16
|
+
cwd: string;
|
|
17
|
+
hook_event_name: "UserPromptSubmit";
|
|
18
|
+
model: string;
|
|
19
|
+
permission_mode: string;
|
|
20
|
+
prompt: string;
|
|
21
|
+
};
|
|
22
|
+
export type CodexPostToolUseInput = {
|
|
23
|
+
session_id: string;
|
|
24
|
+
turn_id: string;
|
|
25
|
+
transcript_path: string | null;
|
|
26
|
+
cwd: string;
|
|
27
|
+
hook_event_name: "PostToolUse";
|
|
28
|
+
model: string;
|
|
29
|
+
permission_mode: string;
|
|
30
|
+
tool_name: string;
|
|
31
|
+
tool_input: unknown;
|
|
32
|
+
tool_response: unknown;
|
|
33
|
+
tool_use_id: string;
|
|
34
|
+
};
|
|
35
|
+
export type CodexPostCompactInput = {
|
|
36
|
+
session_id: string;
|
|
37
|
+
turn_id: string;
|
|
38
|
+
transcript_path: string | null;
|
|
39
|
+
cwd: string;
|
|
40
|
+
hook_event_name: "PostCompact";
|
|
41
|
+
model: string;
|
|
42
|
+
trigger: "manual" | "auto";
|
|
43
|
+
};
|
|
44
|
+
export declare function runSessionStartHook(input: CodexSessionStartInput, options?: CodexRulesHookOptions): Promise<string>;
|
|
45
|
+
export declare function runPostCompactHook(input: CodexPostCompactInput, options?: CodexRulesHookOptions): Promise<string>;
|
|
46
|
+
export declare function runUserPromptSubmitHook(input: CodexUserPromptSubmitInput, options?: CodexRulesHookOptions): Promise<string>;
|
|
47
|
+
export declare function runPostToolUseHook(input: CodexPostToolUseInput, options?: CodexRulesHookOptions): Promise<string>;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { configFromEnvironment } from "./config.js";
|
|
2
|
+
import { hasContextPressureMarker, transcriptHasContextPressureMarker } from "./context-pressure.js";
|
|
3
|
+
import { createHookDebugTimer } from "./debug-log.js";
|
|
4
|
+
import { fingerprintDynamicTargets } from "./dynamic-target-fingerprints.js";
|
|
5
|
+
import { withDynamicBudget } from "./event-budget.js";
|
|
6
|
+
import { formatAdditionalContextOutput } from "./hook-output.js";
|
|
7
|
+
import { displayPath, uniqueStrings } from "./path-utils.js";
|
|
8
|
+
import { claimPostCompactPending, clearSessionState, hasPostCompactPending, hydrateEngineState, isPostCompactRecoveryInProgress, markSessionCompacted, persistEngineState, sessionCachePath, } from "./persistent-cache.js";
|
|
9
|
+
import { withPostCompactBudget } from "./post-compact-budget.js";
|
|
10
|
+
import { claimedPostCompactKind, shouldSkipPostCompactClaim } from "./post-compact-claim.js";
|
|
11
|
+
import { createRulesEngine } from "./rules-engine-factory.js";
|
|
12
|
+
import { runStaticInjection } from "./static-injection.js";
|
|
13
|
+
import { extractCodexToolPaths } from "./tool-paths.js";
|
|
14
|
+
import { filterRulesAlreadyInTranscript } from "./transcript-rule-filter.js";
|
|
15
|
+
export async function runSessionStartHook(input, options = {}) {
|
|
16
|
+
const cachePath = sessionCachePath(input.session_id, options.pluginDataRoot);
|
|
17
|
+
if (input.source === "clear") {
|
|
18
|
+
clearSessionState(cachePath);
|
|
19
|
+
}
|
|
20
|
+
else if (input.source !== "resume" && input.source !== "compact" && !hasPostCompactPending(cachePath)) {
|
|
21
|
+
clearSessionState(cachePath);
|
|
22
|
+
}
|
|
23
|
+
const postCompactClaim = input.source === "clear" ? "not-pending" : claimPostCompactPending(cachePath, "static");
|
|
24
|
+
const completedPostCompactKind = claimedPostCompactKind(postCompactClaim, "static") ??
|
|
25
|
+
(input.source === "compact" && postCompactClaim === "not-pending" ? "static" : undefined);
|
|
26
|
+
if (shouldSkipPostCompactClaim(postCompactClaim, input.source === "compact" && isPostCompactRecoveryInProgress(cachePath, "static"))) {
|
|
27
|
+
return "";
|
|
28
|
+
}
|
|
29
|
+
const transcriptPath = input.source === "clear" ? null : input.transcript_path;
|
|
30
|
+
return runStaticInjection(input.cwd, transcriptPath, "SessionStart", cachePath, options, completedPostCompactKind, { latestCompactedReplacementOnly: completedPostCompactKind !== undefined }, input.model);
|
|
31
|
+
}
|
|
32
|
+
export async function runPostCompactHook(input, options = {}) {
|
|
33
|
+
markSessionCompacted(sessionCachePath(input.session_id, options.pluginDataRoot));
|
|
34
|
+
return "";
|
|
35
|
+
}
|
|
36
|
+
export async function runUserPromptSubmitHook(input, options = {}) {
|
|
37
|
+
if (hasContextPressureMarker(input.prompt)) {
|
|
38
|
+
return "";
|
|
39
|
+
}
|
|
40
|
+
const cachePath = sessionCachePath(input.session_id, options.pluginDataRoot);
|
|
41
|
+
const postCompactClaim = claimPostCompactPending(cachePath, "static");
|
|
42
|
+
if (postCompactClaim === "not-pending" && transcriptHasContextPressureMarker(input.transcript_path)) {
|
|
43
|
+
return "";
|
|
44
|
+
}
|
|
45
|
+
const completedPostCompactKind = claimedPostCompactKind(postCompactClaim, "static");
|
|
46
|
+
if (shouldSkipPostCompactClaim(postCompactClaim, isPostCompactRecoveryInProgress(cachePath, "static"))) {
|
|
47
|
+
return "";
|
|
48
|
+
}
|
|
49
|
+
return runStaticInjection(input.cwd, input.transcript_path, "UserPromptSubmit", cachePath, options, completedPostCompactKind, { latestCompactedReplacementOnly: completedPostCompactKind !== undefined }, input.model);
|
|
50
|
+
}
|
|
51
|
+
export async function runPostToolUseHook(input, options = {}) {
|
|
52
|
+
const debugTimer = createHookDebugTimer("PostToolUse");
|
|
53
|
+
const config = configFromEnvironment(options.env);
|
|
54
|
+
debugTimer.lap("config", { disabled: config.disabled, mode: config.mode });
|
|
55
|
+
if (config.disabled || config.mode === "off" || config.mode === "static") {
|
|
56
|
+
debugTimer.done({ outputBytes: 0, reason: "disabled" });
|
|
57
|
+
return "";
|
|
58
|
+
}
|
|
59
|
+
const targetPaths = extractCodexToolPaths(input, input.cwd);
|
|
60
|
+
debugTimer.lap("extract", {
|
|
61
|
+
targets: targetPaths.length,
|
|
62
|
+
uniqueTargets: uniqueStrings(targetPaths).length,
|
|
63
|
+
tool: input.tool_name,
|
|
64
|
+
});
|
|
65
|
+
const firstTargetPath = targetPaths[0];
|
|
66
|
+
if (firstTargetPath === undefined) {
|
|
67
|
+
debugTimer.done({ outputBytes: 0, reason: "no-target" });
|
|
68
|
+
return "";
|
|
69
|
+
}
|
|
70
|
+
const cachePath = sessionCachePath(input.session_id, options.pluginDataRoot);
|
|
71
|
+
const postCompactClaim = claimPostCompactPending(cachePath, "dynamic");
|
|
72
|
+
if (postCompactClaim === "not-pending" && transcriptHasContextPressureMarker(input.transcript_path)) {
|
|
73
|
+
debugTimer.done({ outputBytes: 0, reason: "context-pressure-transcript" });
|
|
74
|
+
return "";
|
|
75
|
+
}
|
|
76
|
+
const completedPostCompactKind = claimedPostCompactKind(postCompactClaim, "dynamic");
|
|
77
|
+
if (shouldSkipPostCompactClaim(postCompactClaim, isPostCompactRecoveryInProgress(cachePath, "dynamic"))) {
|
|
78
|
+
debugTimer.done({ outputBytes: 0, reason: "post-compact-recovery-in-progress" });
|
|
79
|
+
return "";
|
|
80
|
+
}
|
|
81
|
+
const dynamicConfig = withDynamicBudget(config);
|
|
82
|
+
const engine = createRulesEngine(options, completedPostCompactKind !== undefined
|
|
83
|
+
? withPostCompactBudget(dynamicConfig, { model: input.model, transcriptPath: input.transcript_path })
|
|
84
|
+
: dynamicConfig);
|
|
85
|
+
hydrateEngineState(engine, cachePath);
|
|
86
|
+
debugTimer.lap("hydrate", {
|
|
87
|
+
dynamicDedupScopes: engine.state.dynamicDedup.size,
|
|
88
|
+
dynamicTargetFingerprints: engine.state.dynamicTargetFingerprints.size,
|
|
89
|
+
staticDedup: engine.state.staticDedup.size,
|
|
90
|
+
});
|
|
91
|
+
const dynamicTargetFingerprints = fingerprintDynamicTargets(input.cwd, targetPaths, config);
|
|
92
|
+
debugTimer.lap("fingerprint", { fingerprints: dynamicTargetFingerprints.length });
|
|
93
|
+
const pendingTargetFingerprints = dynamicTargetFingerprints.filter((target) => engine.state.dynamicTargetFingerprints.get(target.cacheKey) !== target.fingerprint);
|
|
94
|
+
debugTimer.lap("pending", { pending: pendingTargetFingerprints.length });
|
|
95
|
+
if (pendingTargetFingerprints.length === 0) {
|
|
96
|
+
persistEngineState(engine, cachePath, completedPostCompactKind);
|
|
97
|
+
debugTimer.lap("persist", { reason: "no-pending" });
|
|
98
|
+
debugTimer.done({ outputBytes: 0, reason: "no-pending" });
|
|
99
|
+
return "";
|
|
100
|
+
}
|
|
101
|
+
const loaded = engine.loadDynamicRules(input.cwd, pendingTargetFingerprints.map((target) => target.targetPath));
|
|
102
|
+
debugTimer.lap("load", { diagnostics: loaded.diagnostics.length, loadedRules: loaded.rules.length });
|
|
103
|
+
const rules = filterRulesAlreadyInTranscript(loaded.rules.filter((rule) => !engine.isStaticInjected(rule) && !engine.isDynamicInjected(rule)), input.transcript_path, (rule) => {
|
|
104
|
+
engine.markDynamicInjected(rule);
|
|
105
|
+
}, { latestCompactedReplacementOnly: completedPostCompactKind !== undefined });
|
|
106
|
+
debugTimer.lap("filter", { rules: rules.length });
|
|
107
|
+
for (const target of pendingTargetFingerprints) {
|
|
108
|
+
engine.state.dynamicTargetFingerprints.set(target.cacheKey, target.fingerprint);
|
|
109
|
+
}
|
|
110
|
+
if (rules.length === 0) {
|
|
111
|
+
persistEngineState(engine, cachePath, completedPostCompactKind);
|
|
112
|
+
debugTimer.lap("persist", { reason: "no-rules" });
|
|
113
|
+
debugTimer.done({ outputBytes: 0, reason: "no-rules" });
|
|
114
|
+
return "";
|
|
115
|
+
}
|
|
116
|
+
const firstPendingTargetPath = pendingTargetFingerprints[0]?.targetPath ?? firstTargetPath;
|
|
117
|
+
const block = engine.formatDynamic(rules, displayPath(input.cwd, firstPendingTargetPath));
|
|
118
|
+
debugTimer.lap("format", { blockChars: block.length, rules: rules.length });
|
|
119
|
+
for (const rule of rules) {
|
|
120
|
+
engine.markDynamicInjected(rule);
|
|
121
|
+
}
|
|
122
|
+
persistEngineState(engine, cachePath, completedPostCompactKind);
|
|
123
|
+
debugTimer.lap("persist", { reason: "emit" });
|
|
124
|
+
const output = formatAdditionalContextOutput("PostToolUse", block);
|
|
125
|
+
debugTimer.done({ outputBytes: Buffer.byteLength(output), reason: "emit" });
|
|
126
|
+
return output;
|
|
127
|
+
}
|