oh-my-claude-sisyphus 3.1.0 → 3.2.2
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/README.md +3 -1
- package/commands/autopilot.md +131 -0
- package/commands/cancel-autopilot.md +35 -0
- package/dist/__tests__/installer.test.js +1 -1
- package/dist/__tests__/learned-skills/config.test.d.ts +2 -0
- package/dist/__tests__/learned-skills/config.test.d.ts.map +1 -0
- package/dist/__tests__/learned-skills/config.test.js +37 -0
- package/dist/__tests__/learned-skills/config.test.js.map +1 -0
- package/dist/__tests__/learned-skills/detector.test.d.ts +2 -0
- package/dist/__tests__/learned-skills/detector.test.d.ts.map +1 -0
- package/dist/__tests__/learned-skills/detector.test.js +99 -0
- package/dist/__tests__/learned-skills/detector.test.js.map +1 -0
- package/dist/__tests__/learned-skills/finder.test.d.ts +2 -0
- package/dist/__tests__/learned-skills/finder.test.d.ts.map +1 -0
- package/dist/__tests__/learned-skills/finder.test.js +59 -0
- package/dist/__tests__/learned-skills/finder.test.js.map +1 -0
- package/dist/__tests__/learned-skills/loader.test.d.ts +2 -0
- package/dist/__tests__/learned-skills/loader.test.d.ts.map +1 -0
- package/dist/__tests__/learned-skills/loader.test.js +69 -0
- package/dist/__tests__/learned-skills/loader.test.js.map +1 -0
- package/dist/__tests__/learned-skills/parser.test.d.ts +2 -0
- package/dist/__tests__/learned-skills/parser.test.d.ts.map +1 -0
- package/dist/__tests__/learned-skills/parser.test.js +81 -0
- package/dist/__tests__/learned-skills/parser.test.js.map +1 -0
- package/dist/__tests__/learned-skills/validator.test.d.ts +2 -0
- package/dist/__tests__/learned-skills/validator.test.d.ts.map +1 -0
- package/dist/__tests__/learned-skills/validator.test.js +85 -0
- package/dist/__tests__/learned-skills/validator.test.js.map +1 -0
- package/dist/__tests__/skills.test.js +8 -4
- package/dist/__tests__/skills.test.js.map +1 -1
- package/dist/agents/definitions.d.ts +32 -0
- package/dist/agents/definitions.d.ts.map +1 -1
- package/dist/agents/definitions.js +93 -1
- package/dist/agents/definitions.js.map +1 -1
- package/dist/agents/delegation-validator.d.ts +31 -0
- package/dist/agents/delegation-validator.d.ts.map +1 -0
- package/dist/agents/delegation-validator.js +75 -0
- package/dist/agents/delegation-validator.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/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/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/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-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 +195 -0
- package/dist/agents/prometheus.js.map +1 -0
- package/dist/agents/prompt-generator.d.ts +95 -0
- package/dist/agents/prompt-generator.d.ts.map +1 -0
- package/dist/agents/prompt-generator.js +140 -0
- package/dist/agents/prompt-generator.js.map +1 -0
- package/dist/agents/prompt-sections/index.d.ts +44 -0
- package/dist/agents/prompt-sections/index.d.ts.map +1 -0
- package/dist/agents/prompt-sections/index.js +194 -0
- package/dist/agents/prompt-sections/index.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 +2 -0
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/types.js.map +1 -1
- package/dist/cli/index.js +0 -0
- package/dist/features/background-agent/manager.d.ts +10 -1
- package/dist/features/background-agent/manager.d.ts.map +1 -1
- package/dist/features/background-agent/manager.js +79 -11
- package/dist/features/background-agent/manager.js.map +1 -1
- package/dist/features/background-agent/types.d.ts +30 -1
- package/dist/features/background-agent/types.d.ts.map +1 -1
- package/dist/features/delegation-categories/index.d.ts +116 -0
- package/dist/features/delegation-categories/index.d.ts.map +1 -0
- package/dist/features/delegation-categories/index.js +287 -0
- package/dist/features/delegation-categories/index.js.map +1 -0
- package/dist/features/delegation-categories/test-categories.d.ts +7 -0
- package/dist/features/delegation-categories/test-categories.d.ts.map +1 -0
- package/dist/features/delegation-categories/test-categories.js +88 -0
- package/dist/features/delegation-categories/test-categories.js.map +1 -0
- package/dist/features/delegation-categories/types.d.ts +51 -0
- package/dist/features/delegation-categories/types.d.ts.map +1 -0
- package/dist/features/delegation-categories/types.js +8 -0
- package/dist/features/delegation-categories/types.js.map +1 -0
- package/dist/features/index.d.ts +2 -0
- package/dist/features/index.d.ts.map +1 -1
- package/dist/features/index.js +10 -0
- package/dist/features/index.js.map +1 -1
- package/dist/features/model-routing/prompts/index.d.ts +2 -0
- package/dist/features/model-routing/prompts/index.d.ts.map +1 -1
- package/dist/features/model-routing/prompts/index.js +6 -0
- package/dist/features/model-routing/prompts/index.js.map +1 -1
- package/dist/features/notepad-wisdom/extractor.d.ts +30 -0
- package/dist/features/notepad-wisdom/extractor.d.ts.map +1 -0
- package/dist/features/notepad-wisdom/extractor.js +68 -0
- package/dist/features/notepad-wisdom/extractor.js.map +1 -0
- package/dist/features/notepad-wisdom/index.d.ts +39 -0
- package/dist/features/notepad-wisdom/index.d.ts.map +1 -0
- package/dist/features/notepad-wisdom/index.js +169 -0
- package/dist/features/notepad-wisdom/index.js.map +1 -0
- package/dist/features/notepad-wisdom/types.d.ts +18 -0
- package/dist/features/notepad-wisdom/types.d.ts.map +1 -0
- package/dist/features/notepad-wisdom/types.js +7 -0
- package/dist/features/notepad-wisdom/types.js.map +1 -0
- package/dist/hooks/autopilot/__tests__/cancel.test.d.ts +2 -0
- package/dist/hooks/autopilot/__tests__/cancel.test.d.ts.map +1 -0
- package/dist/hooks/autopilot/__tests__/cancel.test.js +397 -0
- package/dist/hooks/autopilot/__tests__/cancel.test.js.map +1 -0
- package/dist/hooks/autopilot/__tests__/prompts.test.d.ts +2 -0
- package/dist/hooks/autopilot/__tests__/prompts.test.d.ts.map +1 -0
- package/dist/hooks/autopilot/__tests__/prompts.test.js +74 -0
- package/dist/hooks/autopilot/__tests__/prompts.test.js.map +1 -0
- package/dist/hooks/autopilot/__tests__/state.test.d.ts +2 -0
- package/dist/hooks/autopilot/__tests__/state.test.d.ts.map +1 -0
- package/dist/hooks/autopilot/__tests__/state.test.js +75 -0
- package/dist/hooks/autopilot/__tests__/state.test.js.map +1 -0
- package/dist/hooks/autopilot/__tests__/summary.test.d.ts +2 -0
- package/dist/hooks/autopilot/__tests__/summary.test.d.ts.map +1 -0
- package/dist/hooks/autopilot/__tests__/summary.test.js +289 -0
- package/dist/hooks/autopilot/__tests__/summary.test.js.map +1 -0
- package/dist/hooks/autopilot/__tests__/transition.test.d.ts +2 -0
- package/dist/hooks/autopilot/__tests__/transition.test.d.ts.map +1 -0
- package/dist/hooks/autopilot/__tests__/transition.test.js +59 -0
- package/dist/hooks/autopilot/__tests__/transition.test.js.map +1 -0
- package/dist/hooks/autopilot/__tests__/validation.test.d.ts +2 -0
- package/dist/hooks/autopilot/__tests__/validation.test.d.ts.map +1 -0
- package/dist/hooks/autopilot/__tests__/validation.test.js +450 -0
- package/dist/hooks/autopilot/__tests__/validation.test.js.map +1 -0
- package/dist/hooks/autopilot/cancel.d.ts +42 -0
- package/dist/hooks/autopilot/cancel.d.ts.map +1 -0
- package/dist/hooks/autopilot/cancel.js +156 -0
- package/dist/hooks/autopilot/cancel.js.map +1 -0
- package/dist/hooks/autopilot/enforcement.d.ts +28 -0
- package/dist/hooks/autopilot/enforcement.d.ts.map +1 -0
- package/dist/hooks/autopilot/enforcement.js +147 -0
- package/dist/hooks/autopilot/enforcement.js.map +1 -0
- package/dist/hooks/autopilot/index.d.ts +17 -0
- package/dist/hooks/autopilot/index.d.ts.map +1 -0
- package/dist/hooks/autopilot/index.js +24 -0
- package/dist/hooks/autopilot/index.js.map +1 -0
- package/dist/hooks/autopilot/prompts.d.ts +37 -0
- package/dist/hooks/autopilot/prompts.d.ts.map +1 -0
- package/dist/hooks/autopilot/prompts.js +353 -0
- package/dist/hooks/autopilot/prompts.js.map +1 -0
- package/dist/hooks/autopilot/signals.d.ts +20 -0
- package/dist/hooks/autopilot/signals.d.ts.map +1 -0
- package/dist/hooks/autopilot/signals.js +75 -0
- package/dist/hooks/autopilot/signals.js.map +1 -0
- package/dist/hooks/autopilot/state.d.ts +67 -0
- package/dist/hooks/autopilot/state.d.ts.map +1 -0
- package/dist/hooks/autopilot/state.js +244 -0
- package/dist/hooks/autopilot/state.js.map +1 -0
- package/dist/hooks/autopilot/summary.d.ts +27 -0
- package/dist/hooks/autopilot/summary.d.ts.map +1 -0
- package/dist/hooks/autopilot/summary.js +160 -0
- package/dist/hooks/autopilot/summary.js.map +1 -0
- package/dist/hooks/autopilot/transition.d.ts +39 -0
- package/dist/hooks/autopilot/transition.d.ts.map +1 -0
- package/dist/hooks/autopilot/transition.js +216 -0
- package/dist/hooks/autopilot/transition.js.map +1 -0
- package/dist/hooks/autopilot/types.d.ts +211 -0
- package/dist/hooks/autopilot/types.d.ts.map +1 -0
- package/dist/hooks/autopilot/types.js +30 -0
- package/dist/hooks/autopilot/types.js.map +1 -0
- package/dist/hooks/autopilot/validation.d.ts +43 -0
- package/dist/hooks/autopilot/validation.d.ts.map +1 -0
- package/dist/hooks/autopilot/validation.js +191 -0
- package/dist/hooks/autopilot/validation.js.map +1 -0
- package/dist/hooks/bridge.d.ts +1 -1
- package/dist/hooks/bridge.d.ts.map +1 -1
- package/dist/hooks/bridge.js +64 -3
- package/dist/hooks/bridge.js.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/keyword-detector/index.d.ts +1 -1
- package/dist/hooks/keyword-detector/index.d.ts.map +1 -1
- package/dist/hooks/keyword-detector/index.js +38 -2
- package/dist/hooks/keyword-detector/index.js.map +1 -1
- package/dist/hooks/learned-skills/config.d.ts +53 -0
- package/dist/hooks/learned-skills/config.d.ts.map +1 -0
- package/dist/hooks/learned-skills/config.js +103 -0
- package/dist/hooks/learned-skills/config.js.map +1 -0
- package/dist/hooks/learned-skills/constants.d.ts +24 -0
- package/dist/hooks/learned-skills/constants.d.ts.map +1 -0
- package/dist/hooks/learned-skills/constants.js +26 -0
- package/dist/hooks/learned-skills/constants.js.map +1 -0
- package/dist/hooks/learned-skills/detection-hook.d.ts +39 -0
- package/dist/hooks/learned-skills/detection-hook.d.ts.map +1 -0
- package/dist/hooks/learned-skills/detection-hook.js +83 -0
- package/dist/hooks/learned-skills/detection-hook.js.map +1 -0
- package/dist/hooks/learned-skills/detector.d.ts +30 -0
- package/dist/hooks/learned-skills/detector.d.ts.map +1 -0
- package/dist/hooks/learned-skills/detector.js +150 -0
- package/dist/hooks/learned-skills/detector.js.map +1 -0
- package/dist/hooks/learned-skills/finder.d.ts +21 -0
- package/dist/hooks/learned-skills/finder.d.ts.map +1 -0
- package/dist/hooks/learned-skills/finder.js +117 -0
- package/dist/hooks/learned-skills/finder.js.map +1 -0
- package/dist/hooks/learned-skills/index.d.ts +62 -0
- package/dist/hooks/learned-skills/index.d.ts.map +1 -0
- package/dist/hooks/learned-skills/index.js +137 -0
- package/dist/hooks/learned-skills/index.js.map +1 -0
- package/dist/hooks/learned-skills/loader.d.ts +20 -0
- package/dist/hooks/learned-skills/loader.d.ts.map +1 -0
- package/dist/hooks/learned-skills/loader.js +107 -0
- package/dist/hooks/learned-skills/loader.js.map +1 -0
- package/dist/hooks/learned-skills/parser.d.ts +21 -0
- package/dist/hooks/learned-skills/parser.d.ts.map +1 -0
- package/dist/hooks/learned-skills/parser.js +190 -0
- package/dist/hooks/learned-skills/parser.js.map +1 -0
- package/dist/hooks/learned-skills/promotion.d.ts +29 -0
- package/dist/hooks/learned-skills/promotion.d.ts.map +1 -0
- package/dist/hooks/learned-skills/promotion.js +87 -0
- package/dist/hooks/learned-skills/promotion.js.map +1 -0
- package/dist/hooks/learned-skills/types.d.ts +109 -0
- package/dist/hooks/learned-skills/types.d.ts.map +1 -0
- package/dist/hooks/learned-skills/types.js +8 -0
- package/dist/hooks/learned-skills/types.js.map +1 -0
- package/dist/hooks/learned-skills/validator.d.ts +15 -0
- package/dist/hooks/learned-skills/validator.d.ts.map +1 -0
- package/dist/hooks/learned-skills/validator.js +87 -0
- package/dist/hooks/learned-skills/validator.js.map +1 -0
- package/dist/hooks/learned-skills/writer.d.ts +27 -0
- package/dist/hooks/learned-skills/writer.d.ts.map +1 -0
- package/dist/hooks/learned-skills/writer.js +126 -0
- package/dist/hooks/learned-skills/writer.js.map +1 -0
- package/dist/hooks/mnemosyne/config.d.ts +53 -0
- package/dist/hooks/mnemosyne/config.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/config.js +103 -0
- package/dist/hooks/mnemosyne/config.js.map +1 -0
- package/dist/hooks/mnemosyne/constants.d.ts +24 -0
- package/dist/hooks/mnemosyne/constants.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/constants.js +26 -0
- package/dist/hooks/mnemosyne/constants.js.map +1 -0
- package/dist/hooks/mnemosyne/detection-hook.d.ts +39 -0
- package/dist/hooks/mnemosyne/detection-hook.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/detection-hook.js +83 -0
- package/dist/hooks/mnemosyne/detection-hook.js.map +1 -0
- package/dist/hooks/mnemosyne/detector.d.ts +30 -0
- package/dist/hooks/mnemosyne/detector.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/detector.js +150 -0
- package/dist/hooks/mnemosyne/detector.js.map +1 -0
- package/dist/hooks/mnemosyne/finder.d.ts +21 -0
- package/dist/hooks/mnemosyne/finder.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/finder.js +117 -0
- package/dist/hooks/mnemosyne/finder.js.map +1 -0
- package/dist/hooks/mnemosyne/index.d.ts +62 -0
- package/dist/hooks/mnemosyne/index.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/index.js +137 -0
- package/dist/hooks/mnemosyne/index.js.map +1 -0
- package/dist/hooks/mnemosyne/loader.d.ts +20 -0
- package/dist/hooks/mnemosyne/loader.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/loader.js +113 -0
- package/dist/hooks/mnemosyne/loader.js.map +1 -0
- package/dist/hooks/mnemosyne/parser.d.ts +21 -0
- package/dist/hooks/mnemosyne/parser.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/parser.js +190 -0
- package/dist/hooks/mnemosyne/parser.js.map +1 -0
- package/dist/hooks/mnemosyne/promotion.d.ts +29 -0
- package/dist/hooks/mnemosyne/promotion.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/promotion.js +87 -0
- package/dist/hooks/mnemosyne/promotion.js.map +1 -0
- package/dist/hooks/mnemosyne/types.d.ts +109 -0
- package/dist/hooks/mnemosyne/types.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/types.js +8 -0
- package/dist/hooks/mnemosyne/types.js.map +1 -0
- package/dist/hooks/mnemosyne/validator.d.ts +15 -0
- package/dist/hooks/mnemosyne/validator.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/validator.js +87 -0
- package/dist/hooks/mnemosyne/validator.js.map +1 -0
- package/dist/hooks/mnemosyne/writer.d.ts +27 -0
- package/dist/hooks/mnemosyne/writer.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/writer.js +126 -0
- package/dist/hooks/mnemosyne/writer.js.map +1 -0
- package/dist/hooks/persistent-mode/index.d.ts +6 -2
- package/dist/hooks/persistent-mode/index.d.ts.map +1 -1
- package/dist/hooks/persistent-mode/index.js +33 -3
- package/dist/hooks/persistent-mode/index.js.map +1 -1
- 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 +309 -0
- package/dist/hooks/sisyphus-orchestrator/index.js.map +1 -0
- package/dist/hooks/todo-continuation/index.d.ts +31 -1
- package/dist/hooks/todo-continuation/index.d.ts.map +1 -1
- package/dist/hooks/todo-continuation/index.js +38 -1
- package/dist/hooks/todo-continuation/index.js.map +1 -1
- package/dist/hud/elements/autopilot.d.ts +29 -0
- package/dist/hud/elements/autopilot.d.ts.map +1 -0
- package/dist/hud/elements/autopilot.js +97 -0
- package/dist/hud/elements/autopilot.js.map +1 -0
- package/dist/hud/elements/index.d.ts +1 -0
- package/dist/hud/elements/index.d.ts.map +1 -1
- package/dist/hud/elements/index.js +1 -0
- package/dist/hud/elements/index.js.map +1 -1
- package/dist/hud/index.js +7 -5
- package/dist/hud/index.js.map +1 -1
- package/dist/hud/omc-state.d.ts +7 -0
- package/dist/hud/omc-state.d.ts.map +1 -1
- package/dist/hud/omc-state.js +39 -1
- package/dist/hud/omc-state.js.map +1 -1
- package/dist/hud/render.d.ts.map +1 -1
- package/dist/hud/render.js +7 -0
- package/dist/hud/render.js.map +1 -1
- package/dist/hud/sisyphus-state.d.ts +31 -0
- package/dist/hud/sisyphus-state.d.ts.map +1 -0
- package/dist/hud/sisyphus-state.js +163 -0
- package/dist/hud/sisyphus-state.js.map +1 -0
- package/dist/hud/types.d.ts +5 -0
- package/dist/hud/types.d.ts.map +1 -1
- package/dist/hud/types.js +6 -0
- package/dist/hud/types.js.map +1 -1
- package/dist/installer/index.d.ts +1 -1
- package/dist/installer/index.js +3 -3
- package/dist/installer/index.js.map +1 -1
- package/dist/tools/diagnostics/index.d.ts +29 -0
- package/dist/tools/diagnostics/index.d.ts.map +1 -0
- package/dist/tools/diagnostics/index.js +118 -0
- package/dist/tools/diagnostics/index.js.map +1 -0
- package/dist/tools/diagnostics/lsp-aggregator.d.ts +26 -0
- package/dist/tools/diagnostics/lsp-aggregator.d.ts.map +1 -0
- package/dist/tools/diagnostics/lsp-aggregator.js +99 -0
- package/dist/tools/diagnostics/lsp-aggregator.js.map +1 -0
- package/dist/tools/diagnostics/tsc-runner.d.ts +26 -0
- package/dist/tools/diagnostics/tsc-runner.d.ts.map +1 -0
- package/dist/tools/diagnostics/tsc-runner.js +70 -0
- package/dist/tools/diagnostics/tsc-runner.js.map +1 -0
- package/dist/tools/lsp-tools.d.ts +10 -0
- package/dist/tools/lsp-tools.d.ts.map +1 -1
- package/dist/tools/lsp-tools.js +43 -1
- package/dist/tools/lsp-tools.js.map +1 -1
- package/dist/tools/resume-session.d.ts +63 -0
- package/dist/tools/resume-session.d.ts.map +1 -0
- package/dist/tools/resume-session.js +106 -0
- package/dist/tools/resume-session.js.map +1 -0
- package/dist/utils/__tests__/paths.test.d.ts +2 -0
- package/dist/utils/__tests__/paths.test.d.ts.map +1 -0
- package/dist/utils/__tests__/paths.test.js +88 -0
- package/dist/utils/__tests__/paths.test.js.map +1 -0
- package/dist/utils/paths.d.ts +32 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +55 -0
- package/dist/utils/paths.js.map +1 -0
- package/docs/ARCHITECTURE.md +80 -1
- package/docs/CLAUDE.md +85 -3
- package/docs/FEATURES.md +2167 -0
- package/docs/FULL-README.md +69 -1
- package/package.json +1 -1
- package/skills/autopilot/SKILL.md +168 -0
- package/skills/cancel-autopilot/SKILL.md +53 -0
package/docs/FEATURES.md
ADDED
|
@@ -0,0 +1,2167 @@
|
|
|
1
|
+
# oh-my-claudecode Features Reference
|
|
2
|
+
|
|
3
|
+
> Developer documentation for v3.2 features integrated from oh-my-opencode.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
1. [Notepad Wisdom System](#notepad-wisdom-system)
|
|
7
|
+
2. [Delegation Categories](#delegation-categories)
|
|
8
|
+
3. [Directory Diagnostics](#directory-diagnostics)
|
|
9
|
+
4. [Dynamic Prompt Generation](#dynamic-prompt-generation)
|
|
10
|
+
5. [Agent Templates](#agent-templates)
|
|
11
|
+
6. [Session Resume](#session-resume)
|
|
12
|
+
7. [Autopilot](#autopilot)
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Notepad Wisdom System
|
|
17
|
+
|
|
18
|
+
### Overview
|
|
19
|
+
|
|
20
|
+
The Notepad Wisdom system provides plan-scoped knowledge capture for agents executing tasks. Each plan gets its own notepad directory at `.omc/notepads/{plan-name}/` with four markdown files for categorizing knowledge:
|
|
21
|
+
|
|
22
|
+
- **learnings.md**: Patterns, conventions, successful approaches discovered during execution
|
|
23
|
+
- **decisions.md**: Architectural choices and rationales made during implementation
|
|
24
|
+
- **issues.md**: Problems and blockers encountered that may need attention
|
|
25
|
+
- **problems.md**: Technical debt, gotchas, or ongoing challenges
|
|
26
|
+
|
|
27
|
+
All entries are timestamped automatically, creating an audit trail of the agent's learning process.
|
|
28
|
+
|
|
29
|
+
### API Reference
|
|
30
|
+
|
|
31
|
+
#### `initPlanNotepad(planName: string, directory?: string): boolean`
|
|
32
|
+
|
|
33
|
+
Initialize notepad directory for a plan. Creates `.omc/notepads/{plan-name}/` with 4 empty markdown files.
|
|
34
|
+
|
|
35
|
+
**Parameters:**
|
|
36
|
+
- `planName`: Name of the plan (used as directory name)
|
|
37
|
+
- `directory`: Project root directory (defaults to `process.cwd()`)
|
|
38
|
+
|
|
39
|
+
**Returns:** `true` if successful, `false` on error
|
|
40
|
+
|
|
41
|
+
**Example:**
|
|
42
|
+
```typescript
|
|
43
|
+
import { initPlanNotepad } from '@/features/notepad-wisdom';
|
|
44
|
+
|
|
45
|
+
initPlanNotepad('feature-auth-refactor');
|
|
46
|
+
// Creates: .omc/notepads/feature-auth-refactor/{learnings,decisions,issues,problems}.md
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
#### `readPlanWisdom(planName: string, directory?: string): PlanWisdom`
|
|
52
|
+
|
|
53
|
+
Read all wisdom from a plan's notepad. Returns concatenated wisdom from all 4 categories.
|
|
54
|
+
|
|
55
|
+
**Parameters:**
|
|
56
|
+
- `planName`: Name of the plan
|
|
57
|
+
- `directory`: Project root directory (defaults to `process.cwd()`)
|
|
58
|
+
|
|
59
|
+
**Returns:** `PlanWisdom` object with all entries organized by category
|
|
60
|
+
|
|
61
|
+
**Example:**
|
|
62
|
+
```typescript
|
|
63
|
+
import { readPlanWisdom } from '@/features/notepad-wisdom';
|
|
64
|
+
|
|
65
|
+
const wisdom = readPlanWisdom('feature-auth-refactor');
|
|
66
|
+
console.log(wisdom.learnings.length); // Number of learning entries
|
|
67
|
+
console.log(wisdom.decisions[0].content); // First decision content
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
#### `addLearning(planName: string, content: string, directory?: string): boolean`
|
|
73
|
+
|
|
74
|
+
Add a timestamped learning entry to the plan's notepad.
|
|
75
|
+
|
|
76
|
+
**Parameters:**
|
|
77
|
+
- `planName`: Name of the plan
|
|
78
|
+
- `content`: Learning content to record
|
|
79
|
+
- `directory`: Project root directory (defaults to `process.cwd()`)
|
|
80
|
+
|
|
81
|
+
**Returns:** `true` if successful, `false` on error
|
|
82
|
+
|
|
83
|
+
**Example:**
|
|
84
|
+
```typescript
|
|
85
|
+
import { addLearning } from '@/features/notepad-wisdom';
|
|
86
|
+
|
|
87
|
+
addLearning(
|
|
88
|
+
'feature-auth-refactor',
|
|
89
|
+
'User authentication follows singleton pattern in src/auth/AuthService.ts'
|
|
90
|
+
);
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
#### `addDecision(planName: string, content: string, directory?: string): boolean`
|
|
96
|
+
|
|
97
|
+
Add a timestamped decision entry to the plan's notepad.
|
|
98
|
+
|
|
99
|
+
**Parameters:**
|
|
100
|
+
- `planName`: Name of the plan
|
|
101
|
+
- `content`: Decision content to record
|
|
102
|
+
- `directory`: Project root directory (defaults to `process.cwd()`)
|
|
103
|
+
|
|
104
|
+
**Returns:** `true` if successful, `false` on error
|
|
105
|
+
|
|
106
|
+
**Example:**
|
|
107
|
+
```typescript
|
|
108
|
+
import { addDecision } from '@/features/notepad-wisdom';
|
|
109
|
+
|
|
110
|
+
addDecision(
|
|
111
|
+
'feature-auth-refactor',
|
|
112
|
+
'Using JWT tokens instead of session cookies to maintain stateless architecture'
|
|
113
|
+
);
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
#### `addIssue(planName: string, content: string, directory?: string): boolean`
|
|
119
|
+
|
|
120
|
+
Add a timestamped issue entry to the plan's notepad.
|
|
121
|
+
|
|
122
|
+
**Parameters:**
|
|
123
|
+
- `planName`: Name of the plan
|
|
124
|
+
- `content`: Issue content to record
|
|
125
|
+
- `directory`: Project root directory (defaults to `process.cwd()`)
|
|
126
|
+
|
|
127
|
+
**Returns:** `true` if successful, `false` on error
|
|
128
|
+
|
|
129
|
+
**Example:**
|
|
130
|
+
```typescript
|
|
131
|
+
import { addIssue } from '@/features/notepad-wisdom';
|
|
132
|
+
|
|
133
|
+
addIssue(
|
|
134
|
+
'feature-auth-refactor',
|
|
135
|
+
'TypeScript errors in auth middleware - missing type definitions for req.user'
|
|
136
|
+
);
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
#### `addProblem(planName: string, content: string, directory?: string): boolean`
|
|
142
|
+
|
|
143
|
+
Add a timestamped problem entry to the plan's notepad.
|
|
144
|
+
|
|
145
|
+
**Parameters:**
|
|
146
|
+
- `planName`: Name of the plan
|
|
147
|
+
- `content`: Problem content to record
|
|
148
|
+
- `directory`: Project root directory (defaults to `process.cwd()`)
|
|
149
|
+
|
|
150
|
+
**Returns:** `true` if successful, `false` on error
|
|
151
|
+
|
|
152
|
+
**Example:**
|
|
153
|
+
```typescript
|
|
154
|
+
import { addProblem } from '@/features/notepad-wisdom';
|
|
155
|
+
|
|
156
|
+
addProblem(
|
|
157
|
+
'feature-auth-refactor',
|
|
158
|
+
'Legacy password hashing uses MD5 - needs migration strategy for existing users'
|
|
159
|
+
);
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
#### `getWisdomSummary(planName: string, directory?: string): string`
|
|
165
|
+
|
|
166
|
+
Get a formatted string of all wisdom for a plan. Returns markdown-formatted summary.
|
|
167
|
+
|
|
168
|
+
**Parameters:**
|
|
169
|
+
- `planName`: Name of the plan
|
|
170
|
+
- `directory`: Project root directory (defaults to `process.cwd()`)
|
|
171
|
+
|
|
172
|
+
**Returns:** Markdown-formatted summary string
|
|
173
|
+
|
|
174
|
+
**Example:**
|
|
175
|
+
```typescript
|
|
176
|
+
import { getWisdomSummary } from '@/features/notepad-wisdom';
|
|
177
|
+
|
|
178
|
+
const summary = getWisdomSummary('feature-auth-refactor');
|
|
179
|
+
console.log(summary);
|
|
180
|
+
// # Learnings
|
|
181
|
+
// - [2026-01-21 10:30:45] User authentication follows singleton pattern...
|
|
182
|
+
// # Decisions
|
|
183
|
+
// - [2026-01-21 10:35:12] Using JWT tokens instead of session cookies...
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
### Types
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
export interface WisdomEntry {
|
|
192
|
+
timestamp: string; // ISO 8601 format: "YYYY-MM-DD HH:MM:SS"
|
|
193
|
+
content: string; // Entry content
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export type WisdomCategory = 'learnings' | 'decisions' | 'issues' | 'problems';
|
|
197
|
+
|
|
198
|
+
export interface PlanWisdom {
|
|
199
|
+
planName: string;
|
|
200
|
+
learnings: WisdomEntry[];
|
|
201
|
+
decisions: WisdomEntry[];
|
|
202
|
+
issues: WisdomEntry[];
|
|
203
|
+
problems: WisdomEntry[];
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Examples
|
|
208
|
+
|
|
209
|
+
**Example 1: Agent recording learnings during task execution**
|
|
210
|
+
```typescript
|
|
211
|
+
import { initPlanNotepad, addLearning, addDecision } from '@/features/notepad-wisdom';
|
|
212
|
+
|
|
213
|
+
// Initialize notepad at start of plan
|
|
214
|
+
initPlanNotepad('api-v2-migration');
|
|
215
|
+
|
|
216
|
+
// Record learnings as you discover patterns
|
|
217
|
+
addLearning('api-v2-migration', 'API routes use Express Router pattern in src/routes/');
|
|
218
|
+
addLearning('api-v2-migration', 'Validation middleware applied at route level, not controller');
|
|
219
|
+
|
|
220
|
+
// Record architectural decisions
|
|
221
|
+
addDecision('api-v2-migration', 'Migrating to REST resource pattern with versioned endpoints');
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**Example 2: Reading wisdom for context in follow-up tasks**
|
|
225
|
+
```typescript
|
|
226
|
+
import { readPlanWisdom } from '@/features/notepad-wisdom';
|
|
227
|
+
|
|
228
|
+
const wisdom = readPlanWisdom('api-v2-migration');
|
|
229
|
+
|
|
230
|
+
// Check what was learned previously
|
|
231
|
+
const hasRoutingInfo = wisdom.learnings.some(l =>
|
|
232
|
+
l.content.includes('Express Router')
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
// Review past decisions
|
|
236
|
+
const migrationDecision = wisdom.decisions.find(d =>
|
|
237
|
+
d.content.includes('REST resource pattern')
|
|
238
|
+
);
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
**Example 3: Generating a wisdom report**
|
|
242
|
+
```typescript
|
|
243
|
+
import { getWisdomSummary } from '@/features/notepad-wisdom';
|
|
244
|
+
import { writeFileSync } from 'fs';
|
|
245
|
+
|
|
246
|
+
const summary = getWisdomSummary('api-v2-migration');
|
|
247
|
+
writeFileSync('migration-report.md', summary);
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## Delegation Categories
|
|
253
|
+
|
|
254
|
+
### Overview
|
|
255
|
+
|
|
256
|
+
The Delegation Categories system provides semantic task classification that automatically determines optimal model tier, temperature, and thinking budget. Categories enhance prompts with domain-specific guidance while the model-routing system independently selects the appropriate model.
|
|
257
|
+
|
|
258
|
+
**Available Categories:**
|
|
259
|
+
- **visual-engineering**: UI/UX work, frontend, design systems
|
|
260
|
+
- **ultrabrain**: Complex reasoning, architecture, deep debugging
|
|
261
|
+
- **artistry**: Creative solutions, innovative approaches
|
|
262
|
+
- **quick**: Simple lookups, straightforward operations
|
|
263
|
+
- **writing**: Documentation, technical writing, content
|
|
264
|
+
- **unspecified-low**: Default for simple unclassified tasks
|
|
265
|
+
- **unspecified-high**: Default for complex unclassified tasks
|
|
266
|
+
|
|
267
|
+
### API Reference
|
|
268
|
+
|
|
269
|
+
#### `resolveCategory(category: DelegationCategory): ResolvedCategory`
|
|
270
|
+
|
|
271
|
+
Resolve a category to its full configuration including tier, temperature, and thinking budget.
|
|
272
|
+
|
|
273
|
+
**Parameters:**
|
|
274
|
+
- `category`: The category to resolve
|
|
275
|
+
|
|
276
|
+
**Returns:** Resolved category with full configuration
|
|
277
|
+
|
|
278
|
+
**Example:**
|
|
279
|
+
```typescript
|
|
280
|
+
import { resolveCategory } from '@/features/delegation-categories';
|
|
281
|
+
|
|
282
|
+
const config = resolveCategory('ultrabrain');
|
|
283
|
+
console.log(config.tier); // 'HIGH'
|
|
284
|
+
console.log(config.temperature); // 0.3
|
|
285
|
+
console.log(config.thinkingBudget); // 'max'
|
|
286
|
+
console.log(config.description); // 'Complex reasoning, architecture...'
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
#### `isValidCategory(category: string): category is DelegationCategory`
|
|
292
|
+
|
|
293
|
+
Check if a string is a valid delegation category.
|
|
294
|
+
|
|
295
|
+
**Parameters:**
|
|
296
|
+
- `category`: String to check
|
|
297
|
+
|
|
298
|
+
**Returns:** `true` if valid category
|
|
299
|
+
|
|
300
|
+
**Example:**
|
|
301
|
+
```typescript
|
|
302
|
+
import { isValidCategory } from '@/features/delegation-categories';
|
|
303
|
+
|
|
304
|
+
isValidCategory('ultrabrain'); // true
|
|
305
|
+
isValidCategory('invalid-cat'); // false
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
#### `getAllCategories(): DelegationCategory[]`
|
|
311
|
+
|
|
312
|
+
Get all available delegation categories.
|
|
313
|
+
|
|
314
|
+
**Returns:** Array of all delegation categories
|
|
315
|
+
|
|
316
|
+
**Example:**
|
|
317
|
+
```typescript
|
|
318
|
+
import { getAllCategories } from '@/features/delegation-categories';
|
|
319
|
+
|
|
320
|
+
const categories = getAllCategories();
|
|
321
|
+
// ['visual-engineering', 'ultrabrain', 'artistry', 'quick', 'writing', ...]
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
#### `getCategoryDescription(category: DelegationCategory): string`
|
|
327
|
+
|
|
328
|
+
Get human-readable description for a category.
|
|
329
|
+
|
|
330
|
+
**Parameters:**
|
|
331
|
+
- `category`: The category
|
|
332
|
+
|
|
333
|
+
**Returns:** Description string
|
|
334
|
+
|
|
335
|
+
**Example:**
|
|
336
|
+
```typescript
|
|
337
|
+
import { getCategoryDescription } from '@/features/delegation-categories';
|
|
338
|
+
|
|
339
|
+
const desc = getCategoryDescription('visual-engineering');
|
|
340
|
+
// 'UI/visual reasoning, frontend work, design systems'
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
#### `detectCategoryFromPrompt(taskPrompt: string): DelegationCategory | null`
|
|
346
|
+
|
|
347
|
+
Detect category from task prompt using keyword matching. Requires at least 2 keyword matches for confidence.
|
|
348
|
+
|
|
349
|
+
**Parameters:**
|
|
350
|
+
- `taskPrompt`: The task description
|
|
351
|
+
|
|
352
|
+
**Returns:** Best matching category or `null` if no confident match
|
|
353
|
+
|
|
354
|
+
**Example:**
|
|
355
|
+
```typescript
|
|
356
|
+
import { detectCategoryFromPrompt } from '@/features/delegation-categories';
|
|
357
|
+
|
|
358
|
+
const category = detectCategoryFromPrompt('Design a beautiful dashboard with responsive layout');
|
|
359
|
+
console.log(category); // 'visual-engineering'
|
|
360
|
+
|
|
361
|
+
const category2 = detectCategoryFromPrompt('Debug race condition in payment processor');
|
|
362
|
+
console.log(category2); // 'ultrabrain'
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
---
|
|
366
|
+
|
|
367
|
+
#### `getCategoryForTask(context: CategoryContext): ResolvedCategory`
|
|
368
|
+
|
|
369
|
+
Get category for a task with full context. Handles explicit overrides and auto-detection.
|
|
370
|
+
|
|
371
|
+
**Parameters:**
|
|
372
|
+
- `context`: Category resolution context
|
|
373
|
+
|
|
374
|
+
**Returns:** Resolved category with configuration
|
|
375
|
+
|
|
376
|
+
**Example:**
|
|
377
|
+
```typescript
|
|
378
|
+
import { getCategoryForTask } from '@/features/delegation-categories';
|
|
379
|
+
|
|
380
|
+
// Auto-detect from prompt
|
|
381
|
+
const resolved = getCategoryForTask({
|
|
382
|
+
taskPrompt: 'Create a responsive navigation component'
|
|
383
|
+
});
|
|
384
|
+
console.log(resolved.category); // 'visual-engineering'
|
|
385
|
+
console.log(resolved.temperature); // 0.7
|
|
386
|
+
|
|
387
|
+
// Explicit category override
|
|
388
|
+
const resolved2 = getCategoryForTask({
|
|
389
|
+
taskPrompt: 'Some task',
|
|
390
|
+
explicitCategory: 'ultrabrain'
|
|
391
|
+
});
|
|
392
|
+
console.log(resolved2.category); // 'ultrabrain'
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
---
|
|
396
|
+
|
|
397
|
+
#### `getCategoryTier(category: DelegationCategory): ComplexityTier`
|
|
398
|
+
|
|
399
|
+
Get complexity tier from category (for backward compatibility).
|
|
400
|
+
|
|
401
|
+
**Parameters:**
|
|
402
|
+
- `category`: Delegation category
|
|
403
|
+
|
|
404
|
+
**Returns:** Complexity tier ('LOW' | 'MEDIUM' | 'HIGH')
|
|
405
|
+
|
|
406
|
+
**Example:**
|
|
407
|
+
```typescript
|
|
408
|
+
import { getCategoryTier } from '@/features/delegation-categories';
|
|
409
|
+
|
|
410
|
+
const tier = getCategoryTier('ultrabrain'); // 'HIGH'
|
|
411
|
+
const tier2 = getCategoryTier('quick'); // 'LOW'
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
|
|
416
|
+
#### `getCategoryTemperature(category: DelegationCategory): number`
|
|
417
|
+
|
|
418
|
+
Get temperature setting from category.
|
|
419
|
+
|
|
420
|
+
**Parameters:**
|
|
421
|
+
- `category`: Delegation category
|
|
422
|
+
|
|
423
|
+
**Returns:** Temperature value (0-1)
|
|
424
|
+
|
|
425
|
+
**Example:**
|
|
426
|
+
```typescript
|
|
427
|
+
import { getCategoryTemperature } from '@/features/delegation-categories';
|
|
428
|
+
|
|
429
|
+
const temp = getCategoryTemperature('visual-engineering'); // 0.7
|
|
430
|
+
const temp2 = getCategoryTemperature('ultrabrain'); // 0.3
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
---
|
|
434
|
+
|
|
435
|
+
#### `getCategoryThinkingBudget(category: DelegationCategory): ThinkingBudget`
|
|
436
|
+
|
|
437
|
+
Get thinking budget level from category.
|
|
438
|
+
|
|
439
|
+
**Parameters:**
|
|
440
|
+
- `category`: Delegation category
|
|
441
|
+
|
|
442
|
+
**Returns:** Thinking budget level ('low' | 'medium' | 'high' | 'max')
|
|
443
|
+
|
|
444
|
+
**Example:**
|
|
445
|
+
```typescript
|
|
446
|
+
import { getCategoryThinkingBudget } from '@/features/delegation-categories';
|
|
447
|
+
|
|
448
|
+
const budget = getCategoryThinkingBudget('ultrabrain'); // 'max'
|
|
449
|
+
const budget2 = getCategoryThinkingBudget('quick'); // 'low'
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
---
|
|
453
|
+
|
|
454
|
+
#### `getCategoryThinkingBudgetTokens(category: DelegationCategory): number`
|
|
455
|
+
|
|
456
|
+
Get thinking budget in approximate tokens.
|
|
457
|
+
|
|
458
|
+
**Parameters:**
|
|
459
|
+
- `category`: Delegation category
|
|
460
|
+
|
|
461
|
+
**Returns:** Token budget (1000/5000/10000/32000)
|
|
462
|
+
|
|
463
|
+
**Example:**
|
|
464
|
+
```typescript
|
|
465
|
+
import { getCategoryThinkingBudgetTokens } from '@/features/delegation-categories';
|
|
466
|
+
|
|
467
|
+
const tokens = getCategoryThinkingBudgetTokens('ultrabrain'); // 32000
|
|
468
|
+
const tokens2 = getCategoryThinkingBudgetTokens('quick'); // 1000
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
---
|
|
472
|
+
|
|
473
|
+
#### `getCategoryPromptAppend(category: DelegationCategory): string`
|
|
474
|
+
|
|
475
|
+
Get prompt appendix for category. Returns context-specific guidance added to prompts.
|
|
476
|
+
|
|
477
|
+
**Parameters:**
|
|
478
|
+
- `category`: Delegation category
|
|
479
|
+
|
|
480
|
+
**Returns:** Prompt appendix or empty string
|
|
481
|
+
|
|
482
|
+
**Example:**
|
|
483
|
+
```typescript
|
|
484
|
+
import { getCategoryPromptAppend } from '@/features/delegation-categories';
|
|
485
|
+
|
|
486
|
+
const append = getCategoryPromptAppend('visual-engineering');
|
|
487
|
+
// 'Focus on visual design, user experience, and aesthetic quality...'
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
---
|
|
491
|
+
|
|
492
|
+
#### `enhancePromptWithCategory(taskPrompt: string, category: DelegationCategory): string`
|
|
493
|
+
|
|
494
|
+
Create a delegation prompt with category-specific guidance appended.
|
|
495
|
+
|
|
496
|
+
**Parameters:**
|
|
497
|
+
- `taskPrompt`: Base task prompt
|
|
498
|
+
- `category`: Delegation category
|
|
499
|
+
|
|
500
|
+
**Returns:** Enhanced prompt with category guidance
|
|
501
|
+
|
|
502
|
+
**Example:**
|
|
503
|
+
```typescript
|
|
504
|
+
import { enhancePromptWithCategory } from '@/features/delegation-categories';
|
|
505
|
+
|
|
506
|
+
const enhanced = enhancePromptWithCategory(
|
|
507
|
+
'Create a dashboard component',
|
|
508
|
+
'visual-engineering'
|
|
509
|
+
);
|
|
510
|
+
// 'Create a dashboard component\n\nFocus on visual design, user experience...'
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
---
|
|
514
|
+
|
|
515
|
+
### Types
|
|
516
|
+
|
|
517
|
+
```typescript
|
|
518
|
+
export type DelegationCategory =
|
|
519
|
+
| 'visual-engineering'
|
|
520
|
+
| 'ultrabrain'
|
|
521
|
+
| 'artistry'
|
|
522
|
+
| 'quick'
|
|
523
|
+
| 'writing'
|
|
524
|
+
| 'unspecified-low'
|
|
525
|
+
| 'unspecified-high';
|
|
526
|
+
|
|
527
|
+
export type ThinkingBudget = 'low' | 'medium' | 'high' | 'max';
|
|
528
|
+
|
|
529
|
+
export interface CategoryConfig {
|
|
530
|
+
tier: ComplexityTier; // 'LOW' | 'MEDIUM' | 'HIGH'
|
|
531
|
+
temperature: number; // 0-1
|
|
532
|
+
thinkingBudget: ThinkingBudget;
|
|
533
|
+
promptAppend?: string;
|
|
534
|
+
description: string;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
export interface ResolvedCategory extends CategoryConfig {
|
|
538
|
+
category: DelegationCategory;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
export interface CategoryContext {
|
|
542
|
+
taskPrompt: string;
|
|
543
|
+
agentType?: string;
|
|
544
|
+
explicitCategory?: DelegationCategory;
|
|
545
|
+
explicitTier?: ComplexityTier;
|
|
546
|
+
}
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
### Examples
|
|
550
|
+
|
|
551
|
+
**Example 1: Auto-detecting category for delegation**
|
|
552
|
+
```typescript
|
|
553
|
+
import { getCategoryForTask, enhancePromptWithCategory } from '@/features/delegation-categories';
|
|
554
|
+
|
|
555
|
+
const userRequest = 'Debug the race condition in the payment processor';
|
|
556
|
+
|
|
557
|
+
const resolved = getCategoryForTask({ taskPrompt: userRequest });
|
|
558
|
+
console.log(resolved.category); // 'ultrabrain'
|
|
559
|
+
console.log(resolved.tier); // 'HIGH'
|
|
560
|
+
console.log(resolved.temperature); // 0.3
|
|
561
|
+
|
|
562
|
+
const enhancedPrompt = enhancePromptWithCategory(userRequest, resolved.category);
|
|
563
|
+
// Prompt now includes: "Think deeply and systematically. Consider all edge cases..."
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
**Example 2: Explicit category override for specific needs**
|
|
567
|
+
```typescript
|
|
568
|
+
import { getCategoryForTask } from '@/features/delegation-categories';
|
|
569
|
+
|
|
570
|
+
const resolved = getCategoryForTask({
|
|
571
|
+
taskPrompt: 'Implement user profile page',
|
|
572
|
+
explicitCategory: 'visual-engineering' // Force visual engineering approach
|
|
573
|
+
});
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
**Example 3: Building custom delegation with category configuration**
|
|
577
|
+
```typescript
|
|
578
|
+
import { resolveCategory, getCategoryThinkingBudgetTokens } from '@/features/delegation-categories';
|
|
579
|
+
|
|
580
|
+
const config = resolveCategory('artistry');
|
|
581
|
+
const tokens = getCategoryThinkingBudgetTokens('artistry');
|
|
582
|
+
|
|
583
|
+
const delegationParams = {
|
|
584
|
+
tier: config.tier,
|
|
585
|
+
temperature: config.temperature,
|
|
586
|
+
thinkingBudgetTokens: tokens,
|
|
587
|
+
prompt: config.promptAppend
|
|
588
|
+
? `${basePrompt}\n\n${config.promptAppend}`
|
|
589
|
+
: basePrompt
|
|
590
|
+
};
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
---
|
|
594
|
+
|
|
595
|
+
## Directory Diagnostics
|
|
596
|
+
|
|
597
|
+
### Overview
|
|
598
|
+
|
|
599
|
+
Directory Diagnostics provides project-level QA enforcement for TypeScript/JavaScript projects using a dual-strategy approach:
|
|
600
|
+
|
|
601
|
+
1. **Primary Strategy (tsc)**: Fast, comprehensive TypeScript compilation check via `tsc --noEmit`
|
|
602
|
+
2. **Fallback Strategy (LSP)**: File-by-file Language Server Protocol diagnostics when tsc unavailable
|
|
603
|
+
|
|
604
|
+
The system automatically selects the best strategy based on project configuration.
|
|
605
|
+
|
|
606
|
+
### API Reference
|
|
607
|
+
|
|
608
|
+
#### `runDirectoryDiagnostics(directory: string, strategy?: DiagnosticsStrategy): Promise<DirectoryDiagnosticResult>`
|
|
609
|
+
|
|
610
|
+
Run directory-level diagnostics using the best available strategy.
|
|
611
|
+
|
|
612
|
+
**Parameters:**
|
|
613
|
+
- `directory`: Project directory to check
|
|
614
|
+
- `strategy`: Strategy to use - `'tsc'`, `'lsp'`, or `'auto'` (default: `'auto'`)
|
|
615
|
+
|
|
616
|
+
**Returns:** Promise resolving to diagnostic results
|
|
617
|
+
|
|
618
|
+
**Example:**
|
|
619
|
+
```typescript
|
|
620
|
+
import { runDirectoryDiagnostics } from '@/tools/diagnostics';
|
|
621
|
+
|
|
622
|
+
const result = await runDirectoryDiagnostics('/path/to/project');
|
|
623
|
+
|
|
624
|
+
console.log(result.strategy); // 'tsc' or 'lsp'
|
|
625
|
+
console.log(result.success); // true if no errors
|
|
626
|
+
console.log(result.errorCount); // Number of errors
|
|
627
|
+
console.log(result.warningCount); // Number of warnings
|
|
628
|
+
console.log(result.diagnostics); // Formatted diagnostics output
|
|
629
|
+
console.log(result.summary); // Human-readable summary
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
---
|
|
633
|
+
|
|
634
|
+
### Types
|
|
635
|
+
|
|
636
|
+
```typescript
|
|
637
|
+
export type DiagnosticsStrategy = 'tsc' | 'lsp' | 'auto';
|
|
638
|
+
|
|
639
|
+
export interface DirectoryDiagnosticResult {
|
|
640
|
+
strategy: 'tsc' | 'lsp'; // Strategy that was used
|
|
641
|
+
success: boolean; // true if no errors
|
|
642
|
+
errorCount: number;
|
|
643
|
+
warningCount: number;
|
|
644
|
+
diagnostics: string; // Formatted diagnostic output
|
|
645
|
+
summary: string; // Human-readable summary
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
// Re-exported from sub-modules
|
|
649
|
+
export interface TscDiagnostic {
|
|
650
|
+
file: string;
|
|
651
|
+
line: number;
|
|
652
|
+
column: number;
|
|
653
|
+
severity: 'error' | 'warning';
|
|
654
|
+
code: string;
|
|
655
|
+
message: string;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
export interface TscResult {
|
|
659
|
+
success: boolean;
|
|
660
|
+
errorCount: number;
|
|
661
|
+
warningCount: number;
|
|
662
|
+
diagnostics: TscDiagnostic[];
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
export interface LspDiagnosticWithFile {
|
|
666
|
+
file: string;
|
|
667
|
+
diagnostic: Diagnostic; // VS Code LSP Diagnostic type
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
export interface LspAggregationResult {
|
|
671
|
+
success: boolean;
|
|
672
|
+
errorCount: number;
|
|
673
|
+
warningCount: number;
|
|
674
|
+
filesChecked: number;
|
|
675
|
+
diagnostics: LspDiagnosticWithFile[];
|
|
676
|
+
}
|
|
677
|
+
```
|
|
678
|
+
|
|
679
|
+
### Examples
|
|
680
|
+
|
|
681
|
+
**Example 1: Auto-detect best strategy**
|
|
682
|
+
```typescript
|
|
683
|
+
import { runDirectoryDiagnostics } from '@/tools/diagnostics';
|
|
684
|
+
|
|
685
|
+
const result = await runDirectoryDiagnostics(process.cwd());
|
|
686
|
+
|
|
687
|
+
if (result.success) {
|
|
688
|
+
console.log('All checks passed!');
|
|
689
|
+
} else {
|
|
690
|
+
console.error(`Found ${result.errorCount} errors:`);
|
|
691
|
+
console.error(result.diagnostics);
|
|
692
|
+
}
|
|
693
|
+
```
|
|
694
|
+
|
|
695
|
+
**Example 2: Force specific strategy**
|
|
696
|
+
```typescript
|
|
697
|
+
import { runDirectoryDiagnostics } from '@/tools/diagnostics';
|
|
698
|
+
|
|
699
|
+
// Force tsc even if LSP is available
|
|
700
|
+
const result = await runDirectoryDiagnostics(process.cwd(), 'tsc');
|
|
701
|
+
|
|
702
|
+
console.log(result.summary);
|
|
703
|
+
// 'TypeScript check failed: 3 errors, 1 warnings'
|
|
704
|
+
```
|
|
705
|
+
|
|
706
|
+
**Example 3: Integration with CI/CD**
|
|
707
|
+
```typescript
|
|
708
|
+
import { runDirectoryDiagnostics } from '@/tools/diagnostics';
|
|
709
|
+
|
|
710
|
+
async function ciCheck() {
|
|
711
|
+
const result = await runDirectoryDiagnostics(process.cwd(), 'auto');
|
|
712
|
+
|
|
713
|
+
if (!result.success) {
|
|
714
|
+
console.error(result.diagnostics);
|
|
715
|
+
process.exit(1);
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
console.log('Build quality check passed!');
|
|
719
|
+
}
|
|
720
|
+
```
|
|
721
|
+
|
|
722
|
+
---
|
|
723
|
+
|
|
724
|
+
## Dynamic Prompt Generation
|
|
725
|
+
|
|
726
|
+
### Overview
|
|
727
|
+
|
|
728
|
+
The Dynamic Prompt Generation system builds orchestrator prompts dynamically from agent metadata. Adding a new agent to `definitions.ts` automatically includes it in generated prompts. This ensures the orchestrator always has up-to-date knowledge of available agents.
|
|
729
|
+
|
|
730
|
+
### Generator API
|
|
731
|
+
|
|
732
|
+
#### `generateOrchestratorPrompt(agents: AgentConfig[], options?: GeneratorOptions): string`
|
|
733
|
+
|
|
734
|
+
Generate complete orchestrator prompt from agent definitions.
|
|
735
|
+
|
|
736
|
+
**Parameters:**
|
|
737
|
+
- `agents`: Array of agent configurations
|
|
738
|
+
- `options`: Optional configuration for which sections to include
|
|
739
|
+
|
|
740
|
+
**Returns:** Generated orchestrator prompt string
|
|
741
|
+
|
|
742
|
+
**Example:**
|
|
743
|
+
```typescript
|
|
744
|
+
import { getAgentDefinitions } from '@/agents/definitions';
|
|
745
|
+
import { generateOrchestratorPrompt, convertDefinitionsToConfigs } from '@/agents/prompt-generator';
|
|
746
|
+
|
|
747
|
+
const definitions = getAgentDefinitions();
|
|
748
|
+
const agents = convertDefinitionsToConfigs(definitions);
|
|
749
|
+
const prompt = generateOrchestratorPrompt(agents);
|
|
750
|
+
|
|
751
|
+
console.log(prompt);
|
|
752
|
+
// Full orchestrator prompt with agent registry, triggers, delegation guide, etc.
|
|
753
|
+
```
|
|
754
|
+
|
|
755
|
+
---
|
|
756
|
+
|
|
757
|
+
#### `convertDefinitionsToConfigs(definitions: Record<string, {...}>): AgentConfig[]`
|
|
758
|
+
|
|
759
|
+
Convert agent definitions record to array of AgentConfig for generation.
|
|
760
|
+
|
|
761
|
+
**Parameters:**
|
|
762
|
+
- `definitions`: Record of agent definitions from `getAgentDefinitions()`
|
|
763
|
+
|
|
764
|
+
**Returns:** Array of AgentConfig suitable for prompt generation
|
|
765
|
+
|
|
766
|
+
**Example:**
|
|
767
|
+
```typescript
|
|
768
|
+
import { getAgentDefinitions } from '@/agents/definitions';
|
|
769
|
+
import { convertDefinitionsToConfigs, generateOrchestratorPrompt } from '@/agents/prompt-generator';
|
|
770
|
+
|
|
771
|
+
const definitions = getAgentDefinitions();
|
|
772
|
+
const agents = convertDefinitionsToConfigs(definitions);
|
|
773
|
+
const prompt = generateOrchestratorPrompt(agents);
|
|
774
|
+
```
|
|
775
|
+
|
|
776
|
+
---
|
|
777
|
+
|
|
778
|
+
### Section Builders
|
|
779
|
+
|
|
780
|
+
Individual section builders are exported for custom prompt composition:
|
|
781
|
+
|
|
782
|
+
#### `buildHeader(): string`
|
|
783
|
+
Build the header section with core orchestrator identity.
|
|
784
|
+
|
|
785
|
+
#### `buildAgentRegistry(agents: AgentConfig[]): string`
|
|
786
|
+
Build the agent registry section with descriptions.
|
|
787
|
+
|
|
788
|
+
#### `buildTriggerTable(agents: AgentConfig[]): string`
|
|
789
|
+
Build the trigger table showing when to use each agent.
|
|
790
|
+
|
|
791
|
+
#### `buildToolSelectionSection(agents: AgentConfig[]): string`
|
|
792
|
+
Build tool selection guidance section.
|
|
793
|
+
|
|
794
|
+
#### `buildDelegationMatrix(agents: AgentConfig[]): string`
|
|
795
|
+
Build delegation matrix/guide table.
|
|
796
|
+
|
|
797
|
+
#### `buildOrchestrationPrinciples(): string`
|
|
798
|
+
Build orchestration principles section.
|
|
799
|
+
|
|
800
|
+
#### `buildWorkflow(): string`
|
|
801
|
+
Build workflow section.
|
|
802
|
+
|
|
803
|
+
#### `buildCriticalRules(): string`
|
|
804
|
+
Build critical rules section.
|
|
805
|
+
|
|
806
|
+
#### `buildCompletionChecklist(): string`
|
|
807
|
+
Build completion checklist section.
|
|
808
|
+
|
|
809
|
+
### Types
|
|
810
|
+
|
|
811
|
+
```typescript
|
|
812
|
+
export interface GeneratorOptions {
|
|
813
|
+
includeAgents?: boolean; // default: true
|
|
814
|
+
includeTriggers?: boolean; // default: true
|
|
815
|
+
includeTools?: boolean; // default: true
|
|
816
|
+
includeDelegationTable?: boolean; // default: true
|
|
817
|
+
includePrinciples?: boolean; // default: true
|
|
818
|
+
includeWorkflow?: boolean; // default: true
|
|
819
|
+
includeRules?: boolean; // default: true
|
|
820
|
+
includeChecklist?: boolean; // default: true
|
|
821
|
+
}
|
|
822
|
+
```
|
|
823
|
+
|
|
824
|
+
### Examples
|
|
825
|
+
|
|
826
|
+
**Example 1: Generate full orchestrator prompt**
|
|
827
|
+
```typescript
|
|
828
|
+
import { getAgentDefinitions } from '@/agents/definitions';
|
|
829
|
+
import { generateOrchestratorPrompt, convertDefinitionsToConfigs } from '@/agents/prompt-generator';
|
|
830
|
+
|
|
831
|
+
const definitions = getAgentDefinitions();
|
|
832
|
+
const agents = convertDefinitionsToConfigs(definitions);
|
|
833
|
+
const fullPrompt = generateOrchestratorPrompt(agents);
|
|
834
|
+
```
|
|
835
|
+
|
|
836
|
+
**Example 2: Generate partial prompt (agents + triggers only)**
|
|
837
|
+
```typescript
|
|
838
|
+
import { generateOrchestratorPrompt, convertDefinitionsToConfigs } from '@/agents/prompt-generator';
|
|
839
|
+
import { getAgentDefinitions } from '@/agents/definitions';
|
|
840
|
+
|
|
841
|
+
const agents = convertDefinitionsToConfigs(getAgentDefinitions());
|
|
842
|
+
const partialPrompt = generateOrchestratorPrompt(agents, {
|
|
843
|
+
includeAgents: true,
|
|
844
|
+
includeTriggers: true,
|
|
845
|
+
includeTools: false,
|
|
846
|
+
includeDelegationTable: false,
|
|
847
|
+
includePrinciples: false,
|
|
848
|
+
includeWorkflow: false,
|
|
849
|
+
includeRules: false,
|
|
850
|
+
includeChecklist: false
|
|
851
|
+
});
|
|
852
|
+
```
|
|
853
|
+
|
|
854
|
+
**Example 3: Custom prompt composition with individual builders**
|
|
855
|
+
```typescript
|
|
856
|
+
import {
|
|
857
|
+
buildHeader,
|
|
858
|
+
buildAgentRegistry,
|
|
859
|
+
buildDelegationMatrix
|
|
860
|
+
} from '@/agents/prompt-generator';
|
|
861
|
+
import { getAgentDefinitions } from '@/agents/definitions';
|
|
862
|
+
import { convertDefinitionsToConfigs } from '@/agents/prompt-generator';
|
|
863
|
+
|
|
864
|
+
const agents = convertDefinitionsToConfigs(getAgentDefinitions());
|
|
865
|
+
|
|
866
|
+
const customPrompt = [
|
|
867
|
+
buildHeader(),
|
|
868
|
+
'',
|
|
869
|
+
buildAgentRegistry(agents),
|
|
870
|
+
'',
|
|
871
|
+
buildDelegationMatrix(agents),
|
|
872
|
+
'',
|
|
873
|
+
'CUSTOM SECTION: Special instructions here'
|
|
874
|
+
].join('\n');
|
|
875
|
+
```
|
|
876
|
+
|
|
877
|
+
---
|
|
878
|
+
|
|
879
|
+
## Agent Templates
|
|
880
|
+
|
|
881
|
+
### Overview
|
|
882
|
+
|
|
883
|
+
Agent templates provide standardized prompt structures for common task types. They ensure consistency in agent delegation and make it easier to provide comprehensive context.
|
|
884
|
+
|
|
885
|
+
### Available Templates
|
|
886
|
+
|
|
887
|
+
#### Exploration Template (`src/agents/templates/exploration-template.md`)
|
|
888
|
+
|
|
889
|
+
Use for exploration, research, or search tasks.
|
|
890
|
+
|
|
891
|
+
**Sections:**
|
|
892
|
+
- **TASK**: Clear description of what needs to be explored
|
|
893
|
+
- **EXPECTED OUTCOME**: What the orchestrator expects back
|
|
894
|
+
- **CONTEXT**: Background information to guide exploration
|
|
895
|
+
- **MUST DO**: Required actions
|
|
896
|
+
- **MUST NOT DO**: Constraints
|
|
897
|
+
- **REQUIRED SKILLS**: Skills needed for the task
|
|
898
|
+
- **REQUIRED TOOLS**: Tools the agent should use
|
|
899
|
+
|
|
900
|
+
**Example Use Case:**
|
|
901
|
+
- Finding all implementations of a class
|
|
902
|
+
- Researching how a feature is implemented
|
|
903
|
+
- Exploring database schema
|
|
904
|
+
- Searching for usage patterns
|
|
905
|
+
|
|
906
|
+
---
|
|
907
|
+
|
|
908
|
+
#### Implementation Template (`src/agents/templates/implementation-template.md`)
|
|
909
|
+
|
|
910
|
+
Use for code implementation, refactoring, or modification tasks.
|
|
911
|
+
|
|
912
|
+
**Sections:**
|
|
913
|
+
- **TASK**: Clear description of implementation goal
|
|
914
|
+
- **EXPECTED OUTCOME**: What should be delivered
|
|
915
|
+
- **CONTEXT**: Project background and conventions
|
|
916
|
+
- **MUST DO**: Required actions (tests, types, patterns)
|
|
917
|
+
- **MUST NOT DO**: Constraints (breaking changes, etc.)
|
|
918
|
+
- **REQUIRED SKILLS**: Skills needed
|
|
919
|
+
- **REQUIRED TOOLS**: Tools to use
|
|
920
|
+
- **VERIFICATION CHECKLIST**: Pre-completion checks
|
|
921
|
+
|
|
922
|
+
**Example Use Case:**
|
|
923
|
+
- Adding error handling
|
|
924
|
+
- Implementing new features
|
|
925
|
+
- Refactoring code
|
|
926
|
+
- Adding type definitions
|
|
927
|
+
|
|
928
|
+
---
|
|
929
|
+
|
|
930
|
+
### Examples
|
|
931
|
+
|
|
932
|
+
**Example 1: Using exploration template**
|
|
933
|
+
```typescript
|
|
934
|
+
const explorationTask = `
|
|
935
|
+
## TASK
|
|
936
|
+
Find all implementations of the UserService class and how they handle authentication.
|
|
937
|
+
|
|
938
|
+
## EXPECTED OUTCOME
|
|
939
|
+
- List of file paths with line numbers
|
|
940
|
+
- Summary of authentication patterns found
|
|
941
|
+
- Recommendations for consolidation if multiple patterns exist
|
|
942
|
+
|
|
943
|
+
## CONTEXT
|
|
944
|
+
- TypeScript monorepo using pnpm workspaces
|
|
945
|
+
- Investigating inconsistent authentication behavior
|
|
946
|
+
- Focus on src/services and src/auth directories
|
|
947
|
+
|
|
948
|
+
## MUST DO
|
|
949
|
+
- Use Grep for content search
|
|
950
|
+
- Return structured results with file paths and line numbers
|
|
951
|
+
- Highlight any security concerns
|
|
952
|
+
|
|
953
|
+
## MUST NOT DO
|
|
954
|
+
- Do not modify any files
|
|
955
|
+
- Do not search node_modules
|
|
956
|
+
- Do not include test files in primary results
|
|
957
|
+
`;
|
|
958
|
+
```
|
|
959
|
+
|
|
960
|
+
**Example 2: Using implementation template**
|
|
961
|
+
```typescript
|
|
962
|
+
const implementationTask = `
|
|
963
|
+
## TASK
|
|
964
|
+
Add rate limiting middleware to all API routes.
|
|
965
|
+
|
|
966
|
+
## EXPECTED OUTCOME
|
|
967
|
+
- Rate limiting middleware integrated with tests
|
|
968
|
+
- All API routes protected
|
|
969
|
+
- Configuration via environment variables
|
|
970
|
+
|
|
971
|
+
## CONTEXT
|
|
972
|
+
- Express.js API using TypeScript
|
|
973
|
+
- Existing middleware in src/middleware/
|
|
974
|
+
- Use express-rate-limit (already installed)
|
|
975
|
+
- Apply limits: 100 requests per 15 minutes per IP
|
|
976
|
+
|
|
977
|
+
## MUST DO
|
|
978
|
+
- Create middleware in src/middleware/rate-limit.ts
|
|
979
|
+
- Add TypeScript types
|
|
980
|
+
- Write unit tests
|
|
981
|
+
- Add JSDoc documentation
|
|
982
|
+
- Update README
|
|
983
|
+
|
|
984
|
+
## MUST NOT DO
|
|
985
|
+
- Do not modify existing route handlers
|
|
986
|
+
- Do not hard-code rate limit values
|
|
987
|
+
- Do not break existing tests
|
|
988
|
+
`;
|
|
989
|
+
```
|
|
990
|
+
|
|
991
|
+
---
|
|
992
|
+
|
|
993
|
+
## Session Resume
|
|
994
|
+
|
|
995
|
+
### Overview
|
|
996
|
+
|
|
997
|
+
The Session Resume tool provides a wrapper for resuming background agent sessions. Since Claude Code's native Task tool cannot be extended, this tool retrieves session context and builds continuation prompts for delegation.
|
|
998
|
+
|
|
999
|
+
### API Reference
|
|
1000
|
+
|
|
1001
|
+
#### `resumeSession(input: ResumeSessionInput): ResumeSessionOutput`
|
|
1002
|
+
|
|
1003
|
+
Resume a background agent session and prepare continuation prompt.
|
|
1004
|
+
|
|
1005
|
+
**Parameters:**
|
|
1006
|
+
- `input.sessionId`: Session ID to resume
|
|
1007
|
+
|
|
1008
|
+
**Returns:** Resume context or error
|
|
1009
|
+
|
|
1010
|
+
**Example:**
|
|
1011
|
+
```typescript
|
|
1012
|
+
import { resumeSession } from '@/tools/resume-session';
|
|
1013
|
+
|
|
1014
|
+
const result = resumeSession({ sessionId: 'ses_abc123' });
|
|
1015
|
+
|
|
1016
|
+
if (result.success && result.context) {
|
|
1017
|
+
console.log(result.context.previousPrompt);
|
|
1018
|
+
console.log(result.context.toolCallCount);
|
|
1019
|
+
console.log(result.context.continuationPrompt);
|
|
1020
|
+
|
|
1021
|
+
// Use continuation prompt in next Task delegation
|
|
1022
|
+
Task({
|
|
1023
|
+
subagent_type: "oh-my-claudecode:executor",
|
|
1024
|
+
model: "sonnet",
|
|
1025
|
+
prompt: result.context.continuationPrompt
|
|
1026
|
+
});
|
|
1027
|
+
} else {
|
|
1028
|
+
console.error(result.error);
|
|
1029
|
+
}
|
|
1030
|
+
```
|
|
1031
|
+
|
|
1032
|
+
---
|
|
1033
|
+
|
|
1034
|
+
### Types
|
|
1035
|
+
|
|
1036
|
+
```typescript
|
|
1037
|
+
export interface ResumeSessionInput {
|
|
1038
|
+
sessionId: string; // Session ID to resume
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
export interface ResumeSessionOutput {
|
|
1042
|
+
success: boolean;
|
|
1043
|
+
context?: {
|
|
1044
|
+
previousPrompt: string; // Original prompt from the session
|
|
1045
|
+
toolCallCount: number; // Number of tool calls made so far
|
|
1046
|
+
lastToolUsed?: string; // Last tool used (if any)
|
|
1047
|
+
lastOutputSummary?: string; // Summary of last output (truncated to 500 chars)
|
|
1048
|
+
continuationPrompt: string; // Formatted continuation prompt for next Task
|
|
1049
|
+
};
|
|
1050
|
+
error?: string; // Error message (if failed)
|
|
1051
|
+
}
|
|
1052
|
+
```
|
|
1053
|
+
|
|
1054
|
+
### Examples
|
|
1055
|
+
|
|
1056
|
+
**Example 1: Basic session resume**
|
|
1057
|
+
```typescript
|
|
1058
|
+
import { resumeSession } from '@/tools/resume-session';
|
|
1059
|
+
|
|
1060
|
+
const result = resumeSession({ sessionId: 'ses_abc123' });
|
|
1061
|
+
|
|
1062
|
+
if (result.success && result.context) {
|
|
1063
|
+
console.log(`Resuming session with ${result.context.toolCallCount} prior tool calls`);
|
|
1064
|
+
console.log(`Last used: ${result.context.lastToolUsed}`);
|
|
1065
|
+
}
|
|
1066
|
+
```
|
|
1067
|
+
|
|
1068
|
+
**Example 2: Resume and continue with Task delegation**
|
|
1069
|
+
```typescript
|
|
1070
|
+
import { resumeSession } from '@/tools/resume-session';
|
|
1071
|
+
|
|
1072
|
+
async function continueBackgroundWork(sessionId: string) {
|
|
1073
|
+
const resume = resumeSession({ sessionId });
|
|
1074
|
+
|
|
1075
|
+
if (!resume.success || !resume.context) {
|
|
1076
|
+
throw new Error(resume.error || 'Failed to resume session');
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
// Delegate continuation to same agent type
|
|
1080
|
+
const result = await Task({
|
|
1081
|
+
subagent_type: "oh-my-claudecode:executor",
|
|
1082
|
+
model: "sonnet",
|
|
1083
|
+
prompt: resume.context.continuationPrompt
|
|
1084
|
+
});
|
|
1085
|
+
|
|
1086
|
+
return result;
|
|
1087
|
+
}
|
|
1088
|
+
```
|
|
1089
|
+
|
|
1090
|
+
**Example 3: Checking session progress before resuming**
|
|
1091
|
+
```typescript
|
|
1092
|
+
import { resumeSession } from '@/tools/resume-session';
|
|
1093
|
+
|
|
1094
|
+
const result = resumeSession({ sessionId: 'ses_abc123' });
|
|
1095
|
+
|
|
1096
|
+
if (result.success && result.context) {
|
|
1097
|
+
const { toolCallCount, lastOutputSummary } = result.context;
|
|
1098
|
+
|
|
1099
|
+
console.log(`Session has made ${toolCallCount} tool calls`);
|
|
1100
|
+
console.log(`Last output: ${lastOutputSummary}`);
|
|
1101
|
+
|
|
1102
|
+
// Decide whether to resume or start fresh based on progress
|
|
1103
|
+
if (toolCallCount > 50) {
|
|
1104
|
+
console.warn('Session may be stuck in a loop - consider starting fresh');
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
```
|
|
1108
|
+
|
|
1109
|
+
---
|
|
1110
|
+
|
|
1111
|
+
## Autopilot
|
|
1112
|
+
|
|
1113
|
+
### Overview
|
|
1114
|
+
|
|
1115
|
+
The Autopilot feature provides autonomous execution from an initial idea to fully validated working code. It orchestrates a complete 5-phase development lifecycle with minimal human intervention.
|
|
1116
|
+
|
|
1117
|
+
**5-Phase Workflow:**
|
|
1118
|
+
|
|
1119
|
+
1. **Expansion** - Analyst + Architect expand the idea into detailed requirements and technical spec
|
|
1120
|
+
2. **Planning** - Architect creates comprehensive execution plan (validated by Critic)
|
|
1121
|
+
3. **Execution** - Ralph + Ultrawork implement the plan with parallel task execution
|
|
1122
|
+
4. **QA** - UltraQA ensures build/lint/tests pass through automated fix cycles
|
|
1123
|
+
5. **Validation** - Specialized architects perform functional, security, and quality reviews
|
|
1124
|
+
|
|
1125
|
+
The system automatically transitions between phases, handles mutual exclusion between conflicting modes (Ralph/UltraQA), and preserves progress for resumption if interrupted.
|
|
1126
|
+
|
|
1127
|
+
### Key Features
|
|
1128
|
+
|
|
1129
|
+
- **Zero-prompt planning**: From idea to spec to plan to code automatically
|
|
1130
|
+
- **Parallel execution**: Ultrawork spawns multiple executors for independent tasks
|
|
1131
|
+
- **Automated QA**: Fix-test cycles until build/lint/tests pass
|
|
1132
|
+
- **Multi-architect validation**: Functional, security, and quality review in parallel
|
|
1133
|
+
- **Resumable sessions**: Cancel and resume without losing progress
|
|
1134
|
+
- **Wisdom capture**: Learning entries automatically recorded in notepad system
|
|
1135
|
+
|
|
1136
|
+
### API Reference
|
|
1137
|
+
|
|
1138
|
+
#### Types
|
|
1139
|
+
|
|
1140
|
+
##### `AutopilotPhase`
|
|
1141
|
+
|
|
1142
|
+
```typescript
|
|
1143
|
+
export type AutopilotPhase =
|
|
1144
|
+
| 'expansion' // Requirements gathering and spec creation
|
|
1145
|
+
| 'planning' // Creating detailed execution plan
|
|
1146
|
+
| 'execution' // Implementing the plan
|
|
1147
|
+
| 'qa' // Quality assurance testing
|
|
1148
|
+
| 'validation' // Final verification by architects
|
|
1149
|
+
| 'complete' // Successfully completed
|
|
1150
|
+
| 'failed'; // Failed to complete
|
|
1151
|
+
```
|
|
1152
|
+
|
|
1153
|
+
##### `AutopilotState`
|
|
1154
|
+
|
|
1155
|
+
Complete state for an autopilot session.
|
|
1156
|
+
|
|
1157
|
+
```typescript
|
|
1158
|
+
export interface AutopilotState {
|
|
1159
|
+
active: boolean; // Whether autopilot is currently active
|
|
1160
|
+
phase: AutopilotPhase; // Current phase of execution
|
|
1161
|
+
iteration: number; // Current iteration number
|
|
1162
|
+
max_iterations: number; // Maximum iterations before giving up
|
|
1163
|
+
originalIdea: string; // Original user input
|
|
1164
|
+
|
|
1165
|
+
// State for each phase
|
|
1166
|
+
expansion: AutopilotExpansion;
|
|
1167
|
+
planning: AutopilotPlanning;
|
|
1168
|
+
execution: AutopilotExecution;
|
|
1169
|
+
qa: AutopilotQA;
|
|
1170
|
+
validation: AutopilotValidation;
|
|
1171
|
+
|
|
1172
|
+
// Metrics
|
|
1173
|
+
started_at: string;
|
|
1174
|
+
completed_at: string | null;
|
|
1175
|
+
phase_durations: Record<string, number>;
|
|
1176
|
+
total_agents_spawned: number;
|
|
1177
|
+
wisdom_entries: number;
|
|
1178
|
+
|
|
1179
|
+
// Session binding
|
|
1180
|
+
session_id?: string;
|
|
1181
|
+
}
|
|
1182
|
+
```
|
|
1183
|
+
|
|
1184
|
+
##### `AutopilotConfig`
|
|
1185
|
+
|
|
1186
|
+
Configuration options for autopilot behavior.
|
|
1187
|
+
|
|
1188
|
+
```typescript
|
|
1189
|
+
export interface AutopilotConfig {
|
|
1190
|
+
maxIterations?: number; // Max total iterations (default: 10)
|
|
1191
|
+
maxExpansionIterations?: number; // Max expansion iterations (default: 2)
|
|
1192
|
+
maxArchitectIterations?: number; // Max planning iterations (default: 5)
|
|
1193
|
+
maxQaCycles?: number; // Max QA test-fix cycles (default: 5)
|
|
1194
|
+
maxValidationRounds?: number; // Max validation rounds (default: 3)
|
|
1195
|
+
parallelExecutors?: number; // Number of parallel executors (default: 5)
|
|
1196
|
+
pauseAfterExpansion?: boolean; // Pause for confirmation (default: false)
|
|
1197
|
+
pauseAfterPlanning?: boolean; // Pause for confirmation (default: false)
|
|
1198
|
+
skipQa?: boolean; // Skip QA phase (default: false)
|
|
1199
|
+
skipValidation?: boolean; // Skip validation phase (default: false)
|
|
1200
|
+
autoCommit?: boolean; // Auto-commit when complete (default: false)
|
|
1201
|
+
validationArchitects?: ValidationVerdictType[]; // Validation types (default: all)
|
|
1202
|
+
}
|
|
1203
|
+
```
|
|
1204
|
+
|
|
1205
|
+
##### Phase-Specific State
|
|
1206
|
+
|
|
1207
|
+
**AutopilotExpansion**
|
|
1208
|
+
|
|
1209
|
+
```typescript
|
|
1210
|
+
export interface AutopilotExpansion {
|
|
1211
|
+
analyst_complete: boolean; // Analyst finished requirements
|
|
1212
|
+
architect_complete: boolean; // Architect finished technical design
|
|
1213
|
+
spec_path: string | null; // Path to generated spec
|
|
1214
|
+
requirements_summary: string; // Summary of requirements
|
|
1215
|
+
tech_stack: string[]; // Identified technology stack
|
|
1216
|
+
}
|
|
1217
|
+
```
|
|
1218
|
+
|
|
1219
|
+
**AutopilotPlanning**
|
|
1220
|
+
|
|
1221
|
+
```typescript
|
|
1222
|
+
export interface AutopilotPlanning {
|
|
1223
|
+
plan_path: string | null; // Path to execution plan
|
|
1224
|
+
architect_iterations: number; // Number of architect iterations
|
|
1225
|
+
approved: boolean; // Whether Critic approved the plan
|
|
1226
|
+
}
|
|
1227
|
+
```
|
|
1228
|
+
|
|
1229
|
+
**AutopilotExecution**
|
|
1230
|
+
|
|
1231
|
+
```typescript
|
|
1232
|
+
export interface AutopilotExecution {
|
|
1233
|
+
ralph_iterations: number; // Number of ralph persistence iterations
|
|
1234
|
+
ultrawork_active: boolean; // Whether ultrawork is active
|
|
1235
|
+
tasks_completed: number; // Tasks completed from plan
|
|
1236
|
+
tasks_total: number; // Total tasks in plan
|
|
1237
|
+
files_created: string[]; // Files created during execution
|
|
1238
|
+
files_modified: string[]; // Files modified during execution
|
|
1239
|
+
ralph_completed_at?: string; // Timestamp when ralph completed
|
|
1240
|
+
}
|
|
1241
|
+
```
|
|
1242
|
+
|
|
1243
|
+
**AutopilotQA**
|
|
1244
|
+
|
|
1245
|
+
```typescript
|
|
1246
|
+
export interface AutopilotQA {
|
|
1247
|
+
ultraqa_cycles: number; // Number of test-fix cycles
|
|
1248
|
+
build_status: QAStatus; // Build status (pending/passing/failing)
|
|
1249
|
+
lint_status: QAStatus; // Lint status
|
|
1250
|
+
test_status: QAStatus | 'skipped'; // Test status
|
|
1251
|
+
qa_completed_at?: string; // Timestamp when QA completed
|
|
1252
|
+
}
|
|
1253
|
+
```
|
|
1254
|
+
|
|
1255
|
+
**AutopilotValidation**
|
|
1256
|
+
|
|
1257
|
+
```typescript
|
|
1258
|
+
export interface AutopilotValidation {
|
|
1259
|
+
architects_spawned: number; // Number of validation architects spawned
|
|
1260
|
+
verdicts: ValidationResult[]; // List of validation verdicts
|
|
1261
|
+
all_approved: boolean; // Whether all validations approved
|
|
1262
|
+
validation_rounds: number; // Number of validation rounds performed
|
|
1263
|
+
}
|
|
1264
|
+
```
|
|
1265
|
+
|
|
1266
|
+
##### Validation Types
|
|
1267
|
+
|
|
1268
|
+
```typescript
|
|
1269
|
+
export type ValidationVerdictType = 'functional' | 'security' | 'quality';
|
|
1270
|
+
|
|
1271
|
+
export type ValidationVerdict = 'APPROVED' | 'REJECTED' | 'NEEDS_FIX';
|
|
1272
|
+
|
|
1273
|
+
export interface ValidationResult {
|
|
1274
|
+
type: ValidationVerdictType;
|
|
1275
|
+
verdict: ValidationVerdict;
|
|
1276
|
+
issues?: string[];
|
|
1277
|
+
}
|
|
1278
|
+
```
|
|
1279
|
+
|
|
1280
|
+
---
|
|
1281
|
+
|
|
1282
|
+
#### State Management
|
|
1283
|
+
|
|
1284
|
+
##### `initAutopilot(directory: string, idea: string, sessionId?: string, config?: Partial<AutopilotConfig>): AutopilotState`
|
|
1285
|
+
|
|
1286
|
+
Initialize a new autopilot session.
|
|
1287
|
+
|
|
1288
|
+
**Parameters:**
|
|
1289
|
+
- `directory`: Project directory
|
|
1290
|
+
- `idea`: Original user idea/request
|
|
1291
|
+
- `sessionId`: Optional session ID for binding
|
|
1292
|
+
- `config`: Optional configuration overrides
|
|
1293
|
+
|
|
1294
|
+
**Returns:** Initialized autopilot state
|
|
1295
|
+
|
|
1296
|
+
**Example:**
|
|
1297
|
+
```typescript
|
|
1298
|
+
import { initAutopilot } from '@/hooks/autopilot';
|
|
1299
|
+
|
|
1300
|
+
const state = initAutopilot(
|
|
1301
|
+
process.cwd(),
|
|
1302
|
+
'Create a REST API for user management',
|
|
1303
|
+
'ses_abc123',
|
|
1304
|
+
{ maxQaCycles: 3, parallelExecutors: 3 }
|
|
1305
|
+
);
|
|
1306
|
+
```
|
|
1307
|
+
|
|
1308
|
+
---
|
|
1309
|
+
|
|
1310
|
+
##### `readAutopilotState(directory: string): AutopilotState | null`
|
|
1311
|
+
|
|
1312
|
+
Read current autopilot state from disk.
|
|
1313
|
+
|
|
1314
|
+
**Returns:** Current state or `null` if no session exists
|
|
1315
|
+
|
|
1316
|
+
**Example:**
|
|
1317
|
+
```typescript
|
|
1318
|
+
import { readAutopilotState } from '@/hooks/autopilot';
|
|
1319
|
+
|
|
1320
|
+
const state = readAutopilotState(process.cwd());
|
|
1321
|
+
if (state) {
|
|
1322
|
+
console.log(`Current phase: ${state.phase}`);
|
|
1323
|
+
console.log(`Files created: ${state.execution.files_created.length}`);
|
|
1324
|
+
}
|
|
1325
|
+
```
|
|
1326
|
+
|
|
1327
|
+
---
|
|
1328
|
+
|
|
1329
|
+
##### `writeAutopilotState(directory: string, state: AutopilotState): boolean`
|
|
1330
|
+
|
|
1331
|
+
Write autopilot state to disk.
|
|
1332
|
+
|
|
1333
|
+
**Returns:** `true` if successful
|
|
1334
|
+
|
|
1335
|
+
---
|
|
1336
|
+
|
|
1337
|
+
##### `clearAutopilotState(directory: string): boolean`
|
|
1338
|
+
|
|
1339
|
+
Clear autopilot state file.
|
|
1340
|
+
|
|
1341
|
+
**Returns:** `true` if successful
|
|
1342
|
+
|
|
1343
|
+
---
|
|
1344
|
+
|
|
1345
|
+
##### `isAutopilotActive(directory: string): boolean`
|
|
1346
|
+
|
|
1347
|
+
Check if autopilot is currently active.
|
|
1348
|
+
|
|
1349
|
+
**Example:**
|
|
1350
|
+
```typescript
|
|
1351
|
+
import { isAutopilotActive } from '@/hooks/autopilot';
|
|
1352
|
+
|
|
1353
|
+
if (isAutopilotActive(process.cwd())) {
|
|
1354
|
+
console.log('Autopilot is running');
|
|
1355
|
+
}
|
|
1356
|
+
```
|
|
1357
|
+
|
|
1358
|
+
---
|
|
1359
|
+
|
|
1360
|
+
##### `transitionPhase(directory: string, newPhase: AutopilotPhase): AutopilotState | null`
|
|
1361
|
+
|
|
1362
|
+
Transition to a new phase and record duration metrics.
|
|
1363
|
+
|
|
1364
|
+
**Returns:** Updated state or `null` on error
|
|
1365
|
+
|
|
1366
|
+
**Example:**
|
|
1367
|
+
```typescript
|
|
1368
|
+
import { transitionPhase } from '@/hooks/autopilot';
|
|
1369
|
+
|
|
1370
|
+
const newState = transitionPhase(process.cwd(), 'execution');
|
|
1371
|
+
```
|
|
1372
|
+
|
|
1373
|
+
---
|
|
1374
|
+
|
|
1375
|
+
##### `updateExpansion(directory: string, updates: Partial<AutopilotExpansion>): boolean`
|
|
1376
|
+
|
|
1377
|
+
Update expansion phase data.
|
|
1378
|
+
|
|
1379
|
+
**Example:**
|
|
1380
|
+
```typescript
|
|
1381
|
+
import { updateExpansion } from '@/hooks/autopilot';
|
|
1382
|
+
|
|
1383
|
+
updateExpansion(process.cwd(), {
|
|
1384
|
+
analyst_complete: true,
|
|
1385
|
+
requirements_summary: 'User auth, CRUD operations, rate limiting'
|
|
1386
|
+
});
|
|
1387
|
+
```
|
|
1388
|
+
|
|
1389
|
+
---
|
|
1390
|
+
|
|
1391
|
+
##### `updatePlanning(directory: string, updates: Partial<AutopilotPlanning>): boolean`
|
|
1392
|
+
|
|
1393
|
+
Update planning phase data.
|
|
1394
|
+
|
|
1395
|
+
---
|
|
1396
|
+
|
|
1397
|
+
##### `updateExecution(directory: string, updates: Partial<AutopilotExecution>): boolean`
|
|
1398
|
+
|
|
1399
|
+
Update execution phase data.
|
|
1400
|
+
|
|
1401
|
+
**Example:**
|
|
1402
|
+
```typescript
|
|
1403
|
+
import { updateExecution } from '@/hooks/autopilot';
|
|
1404
|
+
|
|
1405
|
+
updateExecution(process.cwd(), {
|
|
1406
|
+
tasks_completed: 5,
|
|
1407
|
+
files_created: ['src/auth.ts', 'src/routes.ts']
|
|
1408
|
+
});
|
|
1409
|
+
```
|
|
1410
|
+
|
|
1411
|
+
---
|
|
1412
|
+
|
|
1413
|
+
##### `updateQA(directory: string, updates: Partial<AutopilotQA>): boolean`
|
|
1414
|
+
|
|
1415
|
+
Update QA phase data.
|
|
1416
|
+
|
|
1417
|
+
---
|
|
1418
|
+
|
|
1419
|
+
##### `updateValidation(directory: string, updates: Partial<AutopilotValidation>): boolean`
|
|
1420
|
+
|
|
1421
|
+
Update validation phase data.
|
|
1422
|
+
|
|
1423
|
+
---
|
|
1424
|
+
|
|
1425
|
+
##### `incrementAgentCount(directory: string, count?: number): boolean`
|
|
1426
|
+
|
|
1427
|
+
Increment the total agent spawn counter.
|
|
1428
|
+
|
|
1429
|
+
---
|
|
1430
|
+
|
|
1431
|
+
##### `getSpecPath(directory: string): string`
|
|
1432
|
+
|
|
1433
|
+
Get the path where spec will be saved.
|
|
1434
|
+
|
|
1435
|
+
**Returns:** `.omc/autopilot/spec.md`
|
|
1436
|
+
|
|
1437
|
+
---
|
|
1438
|
+
|
|
1439
|
+
##### `getPlanPath(directory: string): string`
|
|
1440
|
+
|
|
1441
|
+
Get the path where plan will be saved.
|
|
1442
|
+
|
|
1443
|
+
**Returns:** `.omc/plans/autopilot-impl.md`
|
|
1444
|
+
|
|
1445
|
+
---
|
|
1446
|
+
|
|
1447
|
+
#### Phase Transitions
|
|
1448
|
+
|
|
1449
|
+
##### `transitionRalphToUltraQA(directory: string, sessionId: string): TransitionResult`
|
|
1450
|
+
|
|
1451
|
+
Transition from Ralph execution to UltraQA with proper mutual exclusion.
|
|
1452
|
+
|
|
1453
|
+
This function handles the critical transition by:
|
|
1454
|
+
1. Preserving Ralph progress
|
|
1455
|
+
2. Cleanly terminating Ralph (and linked Ultrawork)
|
|
1456
|
+
3. Starting UltraQA mode
|
|
1457
|
+
4. Rolling back on failure
|
|
1458
|
+
|
|
1459
|
+
**Parameters:**
|
|
1460
|
+
- `directory`: Project directory
|
|
1461
|
+
- `sessionId`: Session ID for UltraQA binding
|
|
1462
|
+
|
|
1463
|
+
**Returns:** Transition result with success status
|
|
1464
|
+
|
|
1465
|
+
**Example:**
|
|
1466
|
+
```typescript
|
|
1467
|
+
import { transitionRalphToUltraQA } from '@/hooks/autopilot';
|
|
1468
|
+
|
|
1469
|
+
const result = transitionRalphToUltraQA(process.cwd(), 'ses_abc123');
|
|
1470
|
+
if (result.success) {
|
|
1471
|
+
console.log('Successfully transitioned to QA phase');
|
|
1472
|
+
} else {
|
|
1473
|
+
console.error(result.error);
|
|
1474
|
+
}
|
|
1475
|
+
```
|
|
1476
|
+
|
|
1477
|
+
---
|
|
1478
|
+
|
|
1479
|
+
##### `transitionUltraQAToValidation(directory: string): TransitionResult`
|
|
1480
|
+
|
|
1481
|
+
Transition from UltraQA to validation phase.
|
|
1482
|
+
|
|
1483
|
+
---
|
|
1484
|
+
|
|
1485
|
+
##### `transitionToComplete(directory: string): TransitionResult`
|
|
1486
|
+
|
|
1487
|
+
Transition to complete state.
|
|
1488
|
+
|
|
1489
|
+
---
|
|
1490
|
+
|
|
1491
|
+
##### `transitionToFailed(directory: string, error: string): TransitionResult`
|
|
1492
|
+
|
|
1493
|
+
Transition to failed state with error message.
|
|
1494
|
+
|
|
1495
|
+
---
|
|
1496
|
+
|
|
1497
|
+
##### `getTransitionPrompt(fromPhase: string, toPhase: string): string`
|
|
1498
|
+
|
|
1499
|
+
Get a prompt explaining the phase transition for Claude to execute.
|
|
1500
|
+
|
|
1501
|
+
**Example:**
|
|
1502
|
+
```typescript
|
|
1503
|
+
import { getTransitionPrompt } from '@/hooks/autopilot';
|
|
1504
|
+
|
|
1505
|
+
const prompt = getTransitionPrompt('execution', 'qa');
|
|
1506
|
+
// Returns detailed instructions for Ralph → UltraQA transition
|
|
1507
|
+
```
|
|
1508
|
+
|
|
1509
|
+
---
|
|
1510
|
+
|
|
1511
|
+
#### Prompt Generation
|
|
1512
|
+
|
|
1513
|
+
##### `getExpansionPrompt(idea: string): string`
|
|
1514
|
+
|
|
1515
|
+
Generate prompt for expansion phase (Analyst + Architect).
|
|
1516
|
+
|
|
1517
|
+
**Example:**
|
|
1518
|
+
```typescript
|
|
1519
|
+
import { getExpansionPrompt } from '@/hooks/autopilot';
|
|
1520
|
+
|
|
1521
|
+
const prompt = getExpansionPrompt('Build a blog platform with CMS');
|
|
1522
|
+
// Returns prompt with Task invocations for Analyst and Architect
|
|
1523
|
+
```
|
|
1524
|
+
|
|
1525
|
+
---
|
|
1526
|
+
|
|
1527
|
+
##### `getDirectPlanningPrompt(specPath: string): string`
|
|
1528
|
+
|
|
1529
|
+
Generate prompt for planning phase (Architect + Critic).
|
|
1530
|
+
|
|
1531
|
+
---
|
|
1532
|
+
|
|
1533
|
+
##### `getExecutionPrompt(planPath: string): string`
|
|
1534
|
+
|
|
1535
|
+
Generate prompt for execution phase (Ralph + Ultrawork).
|
|
1536
|
+
|
|
1537
|
+
---
|
|
1538
|
+
|
|
1539
|
+
##### `getQAPrompt(): string`
|
|
1540
|
+
|
|
1541
|
+
Generate prompt for QA phase (UltraQA cycles).
|
|
1542
|
+
|
|
1543
|
+
---
|
|
1544
|
+
|
|
1545
|
+
##### `getValidationPrompt(specPath: string): string`
|
|
1546
|
+
|
|
1547
|
+
Generate prompt for validation phase (parallel architect review).
|
|
1548
|
+
|
|
1549
|
+
---
|
|
1550
|
+
|
|
1551
|
+
##### `getPhasePrompt(phase: string, context: object): string`
|
|
1552
|
+
|
|
1553
|
+
Get the appropriate prompt for a given phase with context.
|
|
1554
|
+
|
|
1555
|
+
**Parameters:**
|
|
1556
|
+
- `phase`: Phase name ('expansion', 'planning', etc.)
|
|
1557
|
+
- `context`: Context object with `idea`, `specPath`, `planPath`
|
|
1558
|
+
|
|
1559
|
+
**Example:**
|
|
1560
|
+
```typescript
|
|
1561
|
+
import { getPhasePrompt } from '@/hooks/autopilot';
|
|
1562
|
+
|
|
1563
|
+
const prompt = getPhasePrompt('expansion', {
|
|
1564
|
+
idea: 'E-commerce checkout flow'
|
|
1565
|
+
});
|
|
1566
|
+
```
|
|
1567
|
+
|
|
1568
|
+
---
|
|
1569
|
+
|
|
1570
|
+
#### Validation Coordination
|
|
1571
|
+
|
|
1572
|
+
##### `recordValidationVerdict(directory: string, type: ValidationVerdictType, verdict: ValidationVerdict, issues?: string[]): boolean`
|
|
1573
|
+
|
|
1574
|
+
Record a validation verdict from an architect.
|
|
1575
|
+
|
|
1576
|
+
**Parameters:**
|
|
1577
|
+
- `type`: Validation type ('functional', 'security', 'quality')
|
|
1578
|
+
- `verdict`: Verdict ('APPROVED', 'REJECTED', 'NEEDS_FIX')
|
|
1579
|
+
- `issues`: Optional list of issues found
|
|
1580
|
+
|
|
1581
|
+
**Example:**
|
|
1582
|
+
```typescript
|
|
1583
|
+
import { recordValidationVerdict } from '@/hooks/autopilot';
|
|
1584
|
+
|
|
1585
|
+
recordValidationVerdict(
|
|
1586
|
+
process.cwd(),
|
|
1587
|
+
'security',
|
|
1588
|
+
'REJECTED',
|
|
1589
|
+
['SQL injection risk in user input', 'Missing rate limiting']
|
|
1590
|
+
);
|
|
1591
|
+
```
|
|
1592
|
+
|
|
1593
|
+
---
|
|
1594
|
+
|
|
1595
|
+
##### `getValidationStatus(directory: string): ValidationCoordinatorResult | null`
|
|
1596
|
+
|
|
1597
|
+
Get current validation status and aggregated verdicts.
|
|
1598
|
+
|
|
1599
|
+
**Returns:**
|
|
1600
|
+
```typescript
|
|
1601
|
+
interface ValidationCoordinatorResult {
|
|
1602
|
+
success: boolean; // All verdicts collected
|
|
1603
|
+
allApproved: boolean; // All architects approved
|
|
1604
|
+
verdicts: ValidationResult[];
|
|
1605
|
+
round: number;
|
|
1606
|
+
issues: string[]; // Aggregated issues
|
|
1607
|
+
}
|
|
1608
|
+
```
|
|
1609
|
+
|
|
1610
|
+
**Example:**
|
|
1611
|
+
```typescript
|
|
1612
|
+
import { getValidationStatus } from '@/hooks/autopilot';
|
|
1613
|
+
|
|
1614
|
+
const status = getValidationStatus(process.cwd());
|
|
1615
|
+
if (status?.allApproved) {
|
|
1616
|
+
console.log('All validations passed!');
|
|
1617
|
+
} else {
|
|
1618
|
+
console.log('Issues to fix:', status?.issues);
|
|
1619
|
+
}
|
|
1620
|
+
```
|
|
1621
|
+
|
|
1622
|
+
---
|
|
1623
|
+
|
|
1624
|
+
##### `startValidationRound(directory: string): boolean`
|
|
1625
|
+
|
|
1626
|
+
Start a new validation round (clears previous verdicts).
|
|
1627
|
+
|
|
1628
|
+
---
|
|
1629
|
+
|
|
1630
|
+
##### `shouldRetryValidation(directory: string, maxRounds?: number): boolean`
|
|
1631
|
+
|
|
1632
|
+
Check if validation should retry based on rejections and max rounds.
|
|
1633
|
+
|
|
1634
|
+
---
|
|
1635
|
+
|
|
1636
|
+
##### `getIssuesToFix(directory: string): string[]`
|
|
1637
|
+
|
|
1638
|
+
Get all issues from rejected validations.
|
|
1639
|
+
|
|
1640
|
+
**Example:**
|
|
1641
|
+
```typescript
|
|
1642
|
+
import { getIssuesToFix } from '@/hooks/autopilot';
|
|
1643
|
+
|
|
1644
|
+
const issues = getIssuesToFix(process.cwd());
|
|
1645
|
+
for (const issue of issues) {
|
|
1646
|
+
console.log(issue);
|
|
1647
|
+
// [SECURITY] Missing input validation
|
|
1648
|
+
// [QUALITY] Test coverage below 80%
|
|
1649
|
+
}
|
|
1650
|
+
```
|
|
1651
|
+
|
|
1652
|
+
---
|
|
1653
|
+
|
|
1654
|
+
##### `getValidationSpawnPrompt(specPath: string): string`
|
|
1655
|
+
|
|
1656
|
+
Generate prompt for spawning parallel validation architects.
|
|
1657
|
+
|
|
1658
|
+
---
|
|
1659
|
+
|
|
1660
|
+
##### `formatValidationResults(state: AutopilotState): string`
|
|
1661
|
+
|
|
1662
|
+
Format validation results for display.
|
|
1663
|
+
|
|
1664
|
+
**Example:**
|
|
1665
|
+
```typescript
|
|
1666
|
+
import { readAutopilotState, formatValidationResults } from '@/hooks/autopilot';
|
|
1667
|
+
|
|
1668
|
+
const state = readAutopilotState(process.cwd());
|
|
1669
|
+
if (state) {
|
|
1670
|
+
console.log(formatValidationResults(state));
|
|
1671
|
+
// ## Validation Results
|
|
1672
|
+
// Round: 1
|
|
1673
|
+
// ✓ **FUNCTIONAL**: APPROVED
|
|
1674
|
+
// ✗ **SECURITY**: REJECTED
|
|
1675
|
+
// - SQL injection risk
|
|
1676
|
+
// ✓ **QUALITY**: APPROVED
|
|
1677
|
+
}
|
|
1678
|
+
```
|
|
1679
|
+
|
|
1680
|
+
---
|
|
1681
|
+
|
|
1682
|
+
#### Summary Generation
|
|
1683
|
+
|
|
1684
|
+
##### `generateSummary(directory: string): AutopilotSummary | null`
|
|
1685
|
+
|
|
1686
|
+
Generate summary of autopilot run.
|
|
1687
|
+
|
|
1688
|
+
**Returns:**
|
|
1689
|
+
```typescript
|
|
1690
|
+
interface AutopilotSummary {
|
|
1691
|
+
originalIdea: string;
|
|
1692
|
+
filesCreated: string[];
|
|
1693
|
+
filesModified: string[];
|
|
1694
|
+
testsStatus: string;
|
|
1695
|
+
duration: number; // Milliseconds
|
|
1696
|
+
agentsSpawned: number;
|
|
1697
|
+
phasesCompleted: AutopilotPhase[];
|
|
1698
|
+
}
|
|
1699
|
+
```
|
|
1700
|
+
|
|
1701
|
+
**Example:**
|
|
1702
|
+
```typescript
|
|
1703
|
+
import { generateSummary } from '@/hooks/autopilot';
|
|
1704
|
+
|
|
1705
|
+
const summary = generateSummary(process.cwd());
|
|
1706
|
+
if (summary) {
|
|
1707
|
+
console.log(`Completed in ${summary.duration}ms`);
|
|
1708
|
+
console.log(`Created ${summary.filesCreated.length} files`);
|
|
1709
|
+
console.log(`Used ${summary.agentsSpawned} agents`);
|
|
1710
|
+
}
|
|
1711
|
+
```
|
|
1712
|
+
|
|
1713
|
+
---
|
|
1714
|
+
|
|
1715
|
+
##### `formatSummary(summary: AutopilotSummary): string`
|
|
1716
|
+
|
|
1717
|
+
Format summary as decorated box for terminal display.
|
|
1718
|
+
|
|
1719
|
+
**Example:**
|
|
1720
|
+
```typescript
|
|
1721
|
+
import { generateSummary, formatSummary } from '@/hooks/autopilot';
|
|
1722
|
+
|
|
1723
|
+
const summary = generateSummary(process.cwd());
|
|
1724
|
+
if (summary) {
|
|
1725
|
+
console.log(formatSummary(summary));
|
|
1726
|
+
// ╭──────────────────────────────────────────────────────╮
|
|
1727
|
+
// │ AUTOPILOT COMPLETE │
|
|
1728
|
+
// ├──────────────────────────────────────────────────────┤
|
|
1729
|
+
// │ Original Idea: REST API for user management │
|
|
1730
|
+
// ...
|
|
1731
|
+
}
|
|
1732
|
+
```
|
|
1733
|
+
|
|
1734
|
+
---
|
|
1735
|
+
|
|
1736
|
+
##### `formatCompactSummary(state: AutopilotState): string`
|
|
1737
|
+
|
|
1738
|
+
Format compact summary for HUD statusline.
|
|
1739
|
+
|
|
1740
|
+
**Returns:** `[AUTOPILOT] Phase 3/5: EXECUTION | 12 files`
|
|
1741
|
+
|
|
1742
|
+
---
|
|
1743
|
+
|
|
1744
|
+
##### `formatFailureSummary(state: AutopilotState, error?: string): string`
|
|
1745
|
+
|
|
1746
|
+
Format failure summary with error details.
|
|
1747
|
+
|
|
1748
|
+
---
|
|
1749
|
+
|
|
1750
|
+
##### `formatFileList(files: string[], title: string, maxFiles?: number): string`
|
|
1751
|
+
|
|
1752
|
+
Format file list for detailed summary.
|
|
1753
|
+
|
|
1754
|
+
---
|
|
1755
|
+
|
|
1756
|
+
#### Cancellation
|
|
1757
|
+
|
|
1758
|
+
##### `cancelAutopilot(directory: string): CancelResult`
|
|
1759
|
+
|
|
1760
|
+
Cancel autopilot and preserve progress for resume.
|
|
1761
|
+
|
|
1762
|
+
**Returns:**
|
|
1763
|
+
```typescript
|
|
1764
|
+
interface CancelResult {
|
|
1765
|
+
success: boolean;
|
|
1766
|
+
message: string;
|
|
1767
|
+
preservedState?: AutopilotState;
|
|
1768
|
+
}
|
|
1769
|
+
```
|
|
1770
|
+
|
|
1771
|
+
**Example:**
|
|
1772
|
+
```typescript
|
|
1773
|
+
import { cancelAutopilot } from '@/hooks/autopilot';
|
|
1774
|
+
|
|
1775
|
+
const result = cancelAutopilot(process.cwd());
|
|
1776
|
+
console.log(result.message);
|
|
1777
|
+
// Autopilot cancelled at phase: execution. Progress preserved for resume.
|
|
1778
|
+
```
|
|
1779
|
+
|
|
1780
|
+
---
|
|
1781
|
+
|
|
1782
|
+
##### `clearAutopilot(directory: string): CancelResult`
|
|
1783
|
+
|
|
1784
|
+
Fully clear autopilot state (no preserve).
|
|
1785
|
+
|
|
1786
|
+
---
|
|
1787
|
+
|
|
1788
|
+
##### `canResumeAutopilot(directory: string): { canResume: boolean; state?: AutopilotState; resumePhase?: string }`
|
|
1789
|
+
|
|
1790
|
+
Check if autopilot can be resumed.
|
|
1791
|
+
|
|
1792
|
+
**Example:**
|
|
1793
|
+
```typescript
|
|
1794
|
+
import { canResumeAutopilot } from '@/hooks/autopilot';
|
|
1795
|
+
|
|
1796
|
+
const { canResume, resumePhase } = canResumeAutopilot(process.cwd());
|
|
1797
|
+
if (canResume) {
|
|
1798
|
+
console.log(`Can resume from phase: ${resumePhase}`);
|
|
1799
|
+
}
|
|
1800
|
+
```
|
|
1801
|
+
|
|
1802
|
+
---
|
|
1803
|
+
|
|
1804
|
+
##### `resumeAutopilot(directory: string): { success: boolean; message: string; state?: AutopilotState }`
|
|
1805
|
+
|
|
1806
|
+
Resume a paused autopilot session.
|
|
1807
|
+
|
|
1808
|
+
**Example:**
|
|
1809
|
+
```typescript
|
|
1810
|
+
import { resumeAutopilot } from '@/hooks/autopilot';
|
|
1811
|
+
|
|
1812
|
+
const result = resumeAutopilot(process.cwd());
|
|
1813
|
+
if (result.success) {
|
|
1814
|
+
console.log(result.message); // Resuming autopilot at phase: execution
|
|
1815
|
+
}
|
|
1816
|
+
```
|
|
1817
|
+
|
|
1818
|
+
---
|
|
1819
|
+
|
|
1820
|
+
##### `formatCancelMessage(result: CancelResult): string`
|
|
1821
|
+
|
|
1822
|
+
Format cancel result for display.
|
|
1823
|
+
|
|
1824
|
+
---
|
|
1825
|
+
|
|
1826
|
+
### Usage Examples
|
|
1827
|
+
|
|
1828
|
+
#### Example 1: Starting an autopilot session
|
|
1829
|
+
|
|
1830
|
+
```typescript
|
|
1831
|
+
import {
|
|
1832
|
+
initAutopilot,
|
|
1833
|
+
getPhasePrompt,
|
|
1834
|
+
readAutopilotState
|
|
1835
|
+
} from '@/hooks/autopilot';
|
|
1836
|
+
|
|
1837
|
+
// Initialize session
|
|
1838
|
+
const idea = 'Create a REST API for todo management with authentication';
|
|
1839
|
+
const state = initAutopilot(process.cwd(), idea, 'ses_abc123');
|
|
1840
|
+
|
|
1841
|
+
// Get the expansion phase prompt
|
|
1842
|
+
const prompt = getPhasePrompt('expansion', { idea });
|
|
1843
|
+
console.log(prompt);
|
|
1844
|
+
// Prompt includes Task invocations for Analyst and Architect
|
|
1845
|
+
|
|
1846
|
+
// Monitor progress
|
|
1847
|
+
const currentState = readAutopilotState(process.cwd());
|
|
1848
|
+
console.log(`Phase: ${currentState?.phase}`);
|
|
1849
|
+
console.log(`Agents spawned: ${currentState?.total_agents_spawned}`);
|
|
1850
|
+
```
|
|
1851
|
+
|
|
1852
|
+
#### Example 2: Monitoring execution phase
|
|
1853
|
+
|
|
1854
|
+
```typescript
|
|
1855
|
+
import {
|
|
1856
|
+
readAutopilotState,
|
|
1857
|
+
updateExecution
|
|
1858
|
+
} from '@/hooks/autopilot';
|
|
1859
|
+
|
|
1860
|
+
// Check execution progress
|
|
1861
|
+
const state = readAutopilotState(process.cwd());
|
|
1862
|
+
if (state?.phase === 'execution') {
|
|
1863
|
+
console.log(`Tasks: ${state.execution.tasks_completed}/${state.execution.tasks_total}`);
|
|
1864
|
+
console.log(`Ralph iterations: ${state.execution.ralph_iterations}`);
|
|
1865
|
+
console.log(`Files created: ${state.execution.files_created.length}`);
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
// Update execution progress
|
|
1869
|
+
updateExecution(process.cwd(), {
|
|
1870
|
+
tasks_completed: 8,
|
|
1871
|
+
tasks_total: 12,
|
|
1872
|
+
files_created: ['src/routes/todo.ts', 'src/models/todo.ts']
|
|
1873
|
+
});
|
|
1874
|
+
```
|
|
1875
|
+
|
|
1876
|
+
#### Example 3: Handling phase transitions
|
|
1877
|
+
|
|
1878
|
+
```typescript
|
|
1879
|
+
import {
|
|
1880
|
+
readAutopilotState,
|
|
1881
|
+
transitionRalphToUltraQA,
|
|
1882
|
+
getTransitionPrompt
|
|
1883
|
+
} from '@/hooks/autopilot';
|
|
1884
|
+
|
|
1885
|
+
const state = readAutopilotState(process.cwd());
|
|
1886
|
+
|
|
1887
|
+
if (state?.phase === 'execution' && state.execution.ralph_completed_at) {
|
|
1888
|
+
// Transition from execution to QA
|
|
1889
|
+
const result = transitionRalphToUltraQA(process.cwd(), 'ses_abc123');
|
|
1890
|
+
|
|
1891
|
+
if (result.success) {
|
|
1892
|
+
// Get prompt for Claude to execute QA phase
|
|
1893
|
+
const prompt = getTransitionPrompt('execution', 'qa');
|
|
1894
|
+
console.log(prompt);
|
|
1895
|
+
} else {
|
|
1896
|
+
console.error(`Transition failed: ${result.error}`);
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
```
|
|
1900
|
+
|
|
1901
|
+
#### Example 4: Validation coordination
|
|
1902
|
+
|
|
1903
|
+
```typescript
|
|
1904
|
+
import {
|
|
1905
|
+
getValidationStatus,
|
|
1906
|
+
shouldRetryValidation,
|
|
1907
|
+
getIssuesToFix,
|
|
1908
|
+
recordValidationVerdict
|
|
1909
|
+
} from '@/hooks/autopilot';
|
|
1910
|
+
|
|
1911
|
+
// Record verdicts from architects
|
|
1912
|
+
recordValidationVerdict(process.cwd(), 'functional', 'APPROVED');
|
|
1913
|
+
recordValidationVerdict(process.cwd(), 'security', 'REJECTED', [
|
|
1914
|
+
'Missing input sanitization',
|
|
1915
|
+
'No rate limiting'
|
|
1916
|
+
]);
|
|
1917
|
+
recordValidationVerdict(process.cwd(), 'quality', 'APPROVED');
|
|
1918
|
+
|
|
1919
|
+
// Check status
|
|
1920
|
+
const status = getValidationStatus(process.cwd());
|
|
1921
|
+
if (status?.allApproved) {
|
|
1922
|
+
console.log('All validations passed! Ready to complete.');
|
|
1923
|
+
} else {
|
|
1924
|
+
console.log('Validation failed. Issues to fix:');
|
|
1925
|
+
for (const issue of getIssuesToFix(process.cwd())) {
|
|
1926
|
+
console.log(` - ${issue}`);
|
|
1927
|
+
}
|
|
1928
|
+
|
|
1929
|
+
if (shouldRetryValidation(process.cwd())) {
|
|
1930
|
+
console.log('Retrying validation after fixes...');
|
|
1931
|
+
} else {
|
|
1932
|
+
console.log('Max validation rounds reached');
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
```
|
|
1936
|
+
|
|
1937
|
+
#### Example 5: Cancellation and resumption
|
|
1938
|
+
|
|
1939
|
+
```typescript
|
|
1940
|
+
import {
|
|
1941
|
+
cancelAutopilot,
|
|
1942
|
+
canResumeAutopilot,
|
|
1943
|
+
resumeAutopilot,
|
|
1944
|
+
formatCancelMessage
|
|
1945
|
+
} from '@/hooks/autopilot';
|
|
1946
|
+
|
|
1947
|
+
// Cancel autopilot
|
|
1948
|
+
const cancelResult = cancelAutopilot(process.cwd());
|
|
1949
|
+
console.log(formatCancelMessage(cancelResult));
|
|
1950
|
+
// [AUTOPILOT CANCELLED]
|
|
1951
|
+
// Autopilot cancelled at phase: execution. Progress preserved for resume.
|
|
1952
|
+
// ...
|
|
1953
|
+
|
|
1954
|
+
// Check if can resume
|
|
1955
|
+
const { canResume, resumePhase } = canResumeAutopilot(process.cwd());
|
|
1956
|
+
if (canResume) {
|
|
1957
|
+
console.log(`Session can be resumed from ${resumePhase}`);
|
|
1958
|
+
|
|
1959
|
+
// Resume session
|
|
1960
|
+
const resumeResult = resumeAutopilot(process.cwd());
|
|
1961
|
+
if (resumeResult.success) {
|
|
1962
|
+
console.log(resumeResult.message);
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
```
|
|
1966
|
+
|
|
1967
|
+
#### Example 6: Complete workflow integration
|
|
1968
|
+
|
|
1969
|
+
```typescript
|
|
1970
|
+
import {
|
|
1971
|
+
initAutopilot,
|
|
1972
|
+
readAutopilotState,
|
|
1973
|
+
transitionPhase,
|
|
1974
|
+
generateSummary,
|
|
1975
|
+
formatSummary
|
|
1976
|
+
} from '@/hooks/autopilot';
|
|
1977
|
+
|
|
1978
|
+
async function runAutopilot(idea: string, sessionId: string) {
|
|
1979
|
+
// Initialize
|
|
1980
|
+
const state = initAutopilot(process.cwd(), idea, sessionId);
|
|
1981
|
+
console.log(`Autopilot started in phase: ${state.phase}`);
|
|
1982
|
+
|
|
1983
|
+
// Monitor progress through phases
|
|
1984
|
+
const checkProgress = setInterval(() => {
|
|
1985
|
+
const current = readAutopilotState(process.cwd());
|
|
1986
|
+
if (!current?.active) {
|
|
1987
|
+
clearInterval(checkProgress);
|
|
1988
|
+
|
|
1989
|
+
// Generate final summary
|
|
1990
|
+
const summary = generateSummary(process.cwd());
|
|
1991
|
+
if (summary) {
|
|
1992
|
+
console.log(formatSummary(summary));
|
|
1993
|
+
}
|
|
1994
|
+
} else {
|
|
1995
|
+
console.log(`Current phase: ${current.phase}`);
|
|
1996
|
+
}
|
|
1997
|
+
}, 5000);
|
|
1998
|
+
}
|
|
1999
|
+
```
|
|
2000
|
+
|
|
2001
|
+
---
|
|
2002
|
+
|
|
2003
|
+
### Workflow Details
|
|
2004
|
+
|
|
2005
|
+
#### Phase 0: Expansion
|
|
2006
|
+
|
|
2007
|
+
1. Spawn Analyst agent to extract requirements
|
|
2008
|
+
2. Spawn Architect agent for technical specification
|
|
2009
|
+
3. Combine into unified spec document
|
|
2010
|
+
4. Save to `.omc/autopilot/spec.md`
|
|
2011
|
+
5. Signal: `EXPANSION_COMPLETE`
|
|
2012
|
+
|
|
2013
|
+
#### Phase 1: Planning
|
|
2014
|
+
|
|
2015
|
+
1. Architect reads spec and creates implementation plan
|
|
2016
|
+
2. Critic reviews plan for completeness
|
|
2017
|
+
3. Iterate until Critic approves (max 5 iterations)
|
|
2018
|
+
4. Save to `.omc/plans/autopilot-impl.md`
|
|
2019
|
+
5. Signal: `PLANNING_COMPLETE`
|
|
2020
|
+
|
|
2021
|
+
#### Phase 2: Execution
|
|
2022
|
+
|
|
2023
|
+
1. Activate Ralph + Ultrawork modes
|
|
2024
|
+
2. Read plan and identify parallel tasks
|
|
2025
|
+
3. Spawn executor agents (low/medium/high based on complexity)
|
|
2026
|
+
4. Track progress in TODO list
|
|
2027
|
+
5. Signal: `EXECUTION_COMPLETE` when all tasks done
|
|
2028
|
+
|
|
2029
|
+
#### Phase 3: QA
|
|
2030
|
+
|
|
2031
|
+
1. **Critical**: Transition from Ralph to UltraQA (mutual exclusion)
|
|
2032
|
+
2. Run build → lint → test
|
|
2033
|
+
3. For each failure: diagnose → fix → re-run
|
|
2034
|
+
4. Repeat until pass or max cycles (5)
|
|
2035
|
+
5. Signal: `QA_COMPLETE`
|
|
2036
|
+
|
|
2037
|
+
#### Phase 4: Validation
|
|
2038
|
+
|
|
2039
|
+
1. Spawn 3 parallel architects:
|
|
2040
|
+
- Functional: Verify requirements implemented
|
|
2041
|
+
- Security: Check for vulnerabilities
|
|
2042
|
+
- Quality: Review code quality and tests
|
|
2043
|
+
2. Aggregate verdicts
|
|
2044
|
+
3. If any REJECTED: fix issues and retry (max 3 rounds)
|
|
2045
|
+
4. Signal: `AUTOPILOT_COMPLETE` when all approved
|
|
2046
|
+
|
|
2047
|
+
---
|
|
2048
|
+
|
|
2049
|
+
### State Persistence
|
|
2050
|
+
|
|
2051
|
+
All state is persisted to `.omc/autopilot-state.json`:
|
|
2052
|
+
|
|
2053
|
+
```json
|
|
2054
|
+
{
|
|
2055
|
+
"active": true,
|
|
2056
|
+
"phase": "execution",
|
|
2057
|
+
"iteration": 3,
|
|
2058
|
+
"max_iterations": 10,
|
|
2059
|
+
"originalIdea": "Create REST API...",
|
|
2060
|
+
"expansion": {
|
|
2061
|
+
"analyst_complete": true,
|
|
2062
|
+
"architect_complete": true,
|
|
2063
|
+
"spec_path": ".omc/autopilot/spec.md",
|
|
2064
|
+
"requirements_summary": "...",
|
|
2065
|
+
"tech_stack": ["Node.js", "Express", "TypeScript"]
|
|
2066
|
+
},
|
|
2067
|
+
"planning": {
|
|
2068
|
+
"plan_path": ".omc/plans/autopilot-impl.md",
|
|
2069
|
+
"architect_iterations": 2,
|
|
2070
|
+
"approved": true
|
|
2071
|
+
},
|
|
2072
|
+
"execution": {
|
|
2073
|
+
"ralph_iterations": 5,
|
|
2074
|
+
"ultrawork_active": true,
|
|
2075
|
+
"tasks_completed": 8,
|
|
2076
|
+
"tasks_total": 12,
|
|
2077
|
+
"files_created": ["src/routes.ts", "src/auth.ts"],
|
|
2078
|
+
"files_modified": ["package.json"]
|
|
2079
|
+
},
|
|
2080
|
+
"started_at": "2026-01-21T10:30:00.000Z",
|
|
2081
|
+
"total_agents_spawned": 15,
|
|
2082
|
+
"session_id": "ses_abc123"
|
|
2083
|
+
}
|
|
2084
|
+
```
|
|
2085
|
+
|
|
2086
|
+
---
|
|
2087
|
+
|
|
2088
|
+
## Integration Examples
|
|
2089
|
+
|
|
2090
|
+
### Example 1: Complete agent workflow with wisdom and diagnostics
|
|
2091
|
+
|
|
2092
|
+
```typescript
|
|
2093
|
+
import { initPlanNotepad, addLearning, addDecision } from '@/features/notepad-wisdom';
|
|
2094
|
+
import { runDirectoryDiagnostics } from '@/tools/diagnostics';
|
|
2095
|
+
import { getCategoryForTask } from '@/features/delegation-categories';
|
|
2096
|
+
|
|
2097
|
+
async function executeTaskWithContext(planName: string, taskPrompt: string) {
|
|
2098
|
+
// Initialize notepad
|
|
2099
|
+
initPlanNotepad(planName);
|
|
2100
|
+
|
|
2101
|
+
// Determine delegation category
|
|
2102
|
+
const category = getCategoryForTask({ taskPrompt });
|
|
2103
|
+
console.log(`Using category: ${category.category} (${category.tier})`);
|
|
2104
|
+
|
|
2105
|
+
// Record decision
|
|
2106
|
+
addDecision(planName, `Using ${category.category} category for task delegation`);
|
|
2107
|
+
|
|
2108
|
+
// Execute task (delegate to appropriate agent)
|
|
2109
|
+
// ... task execution ...
|
|
2110
|
+
|
|
2111
|
+
// Record learnings
|
|
2112
|
+
addLearning(planName, 'Successfully implemented feature with proper error handling');
|
|
2113
|
+
|
|
2114
|
+
// Verify with diagnostics
|
|
2115
|
+
const diagnostics = await runDirectoryDiagnostics(process.cwd());
|
|
2116
|
+
|
|
2117
|
+
if (!diagnostics.success) {
|
|
2118
|
+
console.error('Diagnostics failed:', diagnostics.summary);
|
|
2119
|
+
return false;
|
|
2120
|
+
}
|
|
2121
|
+
|
|
2122
|
+
console.log('Task completed successfully with clean diagnostics');
|
|
2123
|
+
return true;
|
|
2124
|
+
}
|
|
2125
|
+
```
|
|
2126
|
+
|
|
2127
|
+
### Example 2: Dynamic orchestrator with auto-generated prompt
|
|
2128
|
+
|
|
2129
|
+
```typescript
|
|
2130
|
+
import { getAgentDefinitions } from '@/agents/definitions';
|
|
2131
|
+
import { generateOrchestratorPrompt, convertDefinitionsToConfigs } from '@/agents/prompt-generator';
|
|
2132
|
+
import { getCategoryForTask } from '@/features/delegation-categories';
|
|
2133
|
+
|
|
2134
|
+
async function createSmartOrchestrator(userRequest: string) {
|
|
2135
|
+
// Generate orchestrator prompt
|
|
2136
|
+
const definitions = getAgentDefinitions();
|
|
2137
|
+
const agents = convertDefinitionsToConfigs(definitions);
|
|
2138
|
+
const orchestratorPrompt = generateOrchestratorPrompt(agents);
|
|
2139
|
+
|
|
2140
|
+
// Detect task category
|
|
2141
|
+
const category = getCategoryForTask({ taskPrompt: userRequest });
|
|
2142
|
+
|
|
2143
|
+
// Build enhanced request
|
|
2144
|
+
const enhancedRequest = `
|
|
2145
|
+
${orchestratorPrompt}
|
|
2146
|
+
|
|
2147
|
+
## USER REQUEST
|
|
2148
|
+
${userRequest}
|
|
2149
|
+
|
|
2150
|
+
## DELEGATION GUIDANCE
|
|
2151
|
+
Detected category: ${category.category}
|
|
2152
|
+
Recommended tier: ${category.tier}
|
|
2153
|
+
Temperature: ${category.temperature}
|
|
2154
|
+
`.trim();
|
|
2155
|
+
|
|
2156
|
+
return enhancedRequest;
|
|
2157
|
+
}
|
|
2158
|
+
```
|
|
2159
|
+
|
|
2160
|
+
---
|
|
2161
|
+
|
|
2162
|
+
## See Also
|
|
2163
|
+
|
|
2164
|
+
- [CHANGELOG.md](../CHANGELOG.md) - Version history and feature additions
|
|
2165
|
+
- [ARCHITECTURE.md](./ARCHITECTURE.md) - System architecture overview
|
|
2166
|
+
- [MIGRATION.md](./MIGRATION.md) - Migration guide from oh-my-opencode
|
|
2167
|
+
- [Agent Definitions](../src/agents/definitions.ts) - Complete agent configuration
|